click to messenger facebook adcreative with page_welcome_message example has issues - facebook-messenger

I am trying to execute the sample curl script that lets you create a click to messenger adcreative with a welcome message. https://developers.facebook.com/ads/blog/post/2018/03/20/click-to-messenger-ads/
But the object_story_spec thats provided in the example generates an error while executing. Please, can anyone help?
Following is the Curl script(copied from the above link) has issues:
'title':'Start Chatting',
'payload':'USER_DEFINED_PAYLOAD'
}
]
}
]
}
},
'quick_replies':[
{
'content_type':'text',
'title':'Hello',
'payload':'reply1'
},
{
'content_type':'text',
'title':'Learn More',
'payload':'reply2'
}
]
}
}"},"page_id": "369499770162312" }' \-F 'access_token=EAADxqKWGDYkBAEZCwo0xa1sQG8LGitmaGtAHp4mfWtwvY27m6xGYPImPnvzPPT8ZAw9pPljFwfhC2DZAYuqMXBD6TZA4yGf1lsh9uUjCYsGr47GpmHZAVajsDdSZCb3GLVKSTmR5fID9eVu9S2HBkeZBRJWZAYxNN6dOz4mRVI4iZCQZDZD' https://graph.facebook.com/v2.11/act_210261016055454/adcreatives

Related

React + Apollo "Getting Started" Error in Prisma Playground

I am in the Getting Started React + Apollo chapter: https://www.howtographql.com/react-apollo/1-getting-started/
When I enter the following query in the Prisma Playground (as the tutorial tells me to do):
mutation CreatePrismaLink {
post(
description: "Prisma gives you a powerful database toolkit 😎"
url: "https://prisma.io"
) {
id
}
}
mutation CreateApolloLink {
post(
description: "The best GraphQL client for React"
url: "https://www.apollographql.com/docs/react/"
) {
id
}
}
I get this error message that I don't understand. It seems to be something about the server
"errors": [
{
"message": "Argument id for data.postedBy.connect.id must not be null. Please use undefined instead.\n",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"post"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"clientVersion": "2.12.1",
"stacktrace": [
"Error: Argument id for data.postedBy.connect.id must not be null. Please use undefined instead.",
"",
" at Document.validate (C:\\Users\\shanm\\hackernews-react-apollo\\server\\node_modules\\#prisma\\client\\runtime\\index.js:77413:19)",
" at NewPrismaClient._executeRequest (C:\\Users\\shanm\\hackernews-react-apollo\\server\\node_modules\\#prisma\\client\\runtime\\index.js:79065:17)",
" at C:\\Users\\shanm\\hackernews-react-apollo\\server\\node_modules\\#prisma\\client\\runtime\\index.js:79002:52",
" at AsyncResource.runInAsyncScope (async_hooks.js:197:9)",
" at NewPrismaClient._request (C:\\Users\\shanm\\hackernews-react-apollo\\server\\node_modules\\#prisma\\client\\runtime\\index.js:79002:25)",
" at Object.then (C:\\Users\\shanm\\hackernews-react-apollo\\server\\node_modules\\#prisma\\client\\runtime\\index.js:79119:39)",
" at processTicksAndRejections (internal/process/task_queues.js:93:5)"
]
}
}
}
],
"data": null
}
please help me find the problem?
This is old but in case somebody else hits this issue and Googles it like me:
Unfortunately the answer here didn't work for me, but the solution is something that was covered in the Node+GraphQL tutorial, which you might not be able to figure out on your own:
In order to post you have to first create a user and then be authorized as that user. The mutation to create a user is listed as an example on the page, but unfortunately the author forgot to instruct the reader to run it before trying to create a post.
Paste this into the playground to create a user
mutation {
signup(name: "Sarah", email: "sarah#prisma.io", password: "graphql") {
token
user {
id
}
}
}
Copy the token that is returned
Open the "HTTP Headers" pane in the bottom left
Enter this with your token:
{
"Authorization": "Bearer TOKEN_HERE"
}
Now you can run the mutations to create the posts
That's because the server has been written with the business rule in mind that a Post will always belong to a User. The database has a NOT NULL postedById field on the Link table i.e. a post will always have a user id attached to it. You need to make postedById field nullable in the Link model in the Prisma ORM schema. To fix this, make the following changes on server side code and relaunch the server
In the server folder go to schema.prisma file, and make both fields postedBy and postedById optional/nullable by suffixing them with ?
postedBy? User #relation(fields: [postedById], references:[id])
postedById? Int
Then run the following command to recreate database with the changes
npx prisma migrate reset
Update the post resolver function in Mutation.js file to replace the line
postedBy: { connect: { id: userId } }
with
postedById: userId,
because prisma connect api does not accept a null value

Firebase Cloud Firestore - Fail to write via REST API

This is not an authentication error, write is enabled on the database rules.
My cloud Firestore database looks like the picture below.
There is a COLLECTION called colA, inside it there is a DOCUMENT called docA, and inside it there are some fields (strings) stored.
On Postman, if I do GET https://firestore.googleapis.com/v1/projects/eletronica-ab6b1/databases/(default)/documents/colA/docA, I do receive the following answer, and it is correct:
{
"name": "projects/eletronica-ab6b1/databases/(default)/documents/colA/docA",
"fields": {
"fieldB": {
"stringValue": "ABCD"
},
"fieldA": {
"stringValue": "888"
}
},
"createTime": "2020-01-31T16:48:26.859181Z",
"updateTime": "2020-02-05T19:21:49.654340Z"
}
Now, when I try to write a new field (fieldC) via POST https://firestore.googleapis.com/v1/projects/eletronica-ab6b1/databases/(default)/documents/colA/docA, with JSON content:
{
"name": "projects/eletronica-ab6b1/databases/(default)/documents/colA/docA",
"fields": {
"fieldC": {
"stringValue": "1000"
}
}
}
After SEND, I receive this:
{
"error": {
"code": 400,
"message": "Document parent name \"projects/eletronica-ab6b1/databases/(default)/documents/colA\" lacks \"/\" at index 60.",
"status": "INVALID_ARGUMENT"
}
}
What I'm doing wrong? I really would like to write strings there via REST API.
Regards.
Updating a document is done with a PATCH request, according to the [reference documentation).
A POST request is used to create a new document in a collection, which probably explains the error you get: you're pointing to a document, but POST expects a collection path.

Discord.js - choosing random image in my pc

I want to make a command where !send image will send random specified image on my pc. this is my array of images
const images = [
'/mybot/images/any image i have there',
'other images'
]
and this is the way it is supposed to choose one
if(message.content === prefix + 'send image')
{
message.channel.send(`${message.author} here you have image`, {
file: RetardedImage[Math.floor(Math.random() * RetardedImage.length)]
});
}```
but it doesnt work and problem is that it doesnt even say error or something so i dont know what the problem is, can someone please help me?
There's no file option for a message, it's called files and it's an array:
if(message.content === prefix + 'send image')
{
message.channel.send(`${message.author} here you have image`, {
files: [
{
name: "myimage.png",
attachment: RetardedImage[Math.floor(Math.random() * RetardedImage.length)]
}
]
});
}
This will send your file properly.
you can make an attachment like this
const attachment = new <Discord>.Attachment("PATH","NAME.EXTENSION")
message.channel.send(`blah blah`+attachment)

Google Calendar API. Patching sharedExtendedProperty for events

I have created event in my Google calendar. Most interesting part is:
{
// some event data;
"extendedProperties": {
"shared": {
"cases_1": "1",
"cases_2": "2"
}
}
}
Right now I need to PATCH existing event. In extendedProperties I do not need "cases_1":"1" any more. So I use developers endpoint to patch it. The PATCH request body is:
{
"extendedProperties": {
"shared": {
"cases_2": "2"
}
}
}
In response I see my both shared fields. How must my request body look like to remove from extendedProperties shared cases_1 field?
Try adding the line below to your request:
{
"extendedProperties": {
"shared": {
"cases_1": null,
"cases_2": "2"
}
}
}
It was shown in this documentation:
Any properties not included in an update request will be deleted, but
a better approach is to make a patch request to set the value to null
Hope this helps.

on_message is not working in python

I am working on aws iot and able to get the shadow state updated by the terminal via shell script .But i am able to get root#raspberrypi:~# ./aws_subscribe.py Connected with result code 0 and also in aws iot home i am getting out of sync error
and i am following this blog
The 'Shadow status' field on the AWS console merely shows if the 'reported' and 'desired' states are the same, it has no functional impact.
This is an example that would show the status as out of sync:
{
"reported": {
"locked": true
},
"desired": {
"locked": false
}
}
Where as this example would show them as in sync.
{
"reported": {
"locked": true
},
"desired": {
"locked": true
}
}
That's really all there is to it. You can completely remove the 'desired' state by sending the following JSON, if you do this it will always show as in sync.
{
"desired": null
}

Resources