I'm developing a bot that receives a call from "conversations webhook" to know when a page receives a new message and answer it from my bot.
I've tried "messages" but I can not even make it activate when they send me a message.
I have my conversations webhook active. The "conversations" callback is something like this:
{"entry":[{"changes":[{"field":"conversations","value":{"thread_id":"t_100006208XXXXXX","page_id":309151156XXXXXX,"thread_key":"t_100006208XXXXXX"}}],"id":"309151156XXXXXX","time":1510581746}],"object":"page"}
The problem is that the webhook always sends the same thread_id and thread_key. The page_id does change, but I can not find the way to know which conversation is the one that varies.
Thank you!
I solved it! The problem was that I made the call to the api with an access_token from my app, and not from the site itself.
Related
I´m using Zapier Webhooks for integration between a Web Portal and an API. Both, the web portal and the API was developed with php. I´m using curl to send a request to a catch hook in Zapier, sending the Post Data. Then in my zap, the second step toke the catched fields and send it as form data to and PUT webhook to my API URL.
The problem is that in my portal, when I print the response of this call it always show something like this:
{"status": "success", "attempt": "5a81c6d1-bb9b-4afe-9ece-0cba4a0a52b0", "id": "cec1978a-c98f-4521-89f3-83a4041c15a4", "request_id": "5a81c6d1-bb9b-4afe-9ece-0cba4a0a52b0"}
But I need the real response of the webhook in the second step, showed in my zapier task as Data Output.
Someone knows why this is happening and how can I get the real response?
Thanks
David here, from the Zapier Platform team.
What you're describing isn't currently possible. When Zapier receives a hook, it lets the sender know the hook was successful and they need not retry; this isn't customizable.
In this situation, it sounds like you need a simple webserver, so you can customize the in and out behavior of your data? Or skip Zapier entirely and send the webhook directly to the destination.
I have created a Facebook messenger bot that is working perfectly. I used php to create it.
Now, I want to add some new functionality. When the bot owner is online in Messenger and starts answering messages, the bot should stop responding to users.
How can i detect when the owner has started answering?
I did a test on this before.
You can try subscribing to "message_echo" webhook. This webhook is called when the page AND the bot sends a message to a user. So you'll need to differentiate which "message_echo" is from the page (a person) and which is from the bot. In the json that webhook sent, messages from the bot will contain an app_id key in the message object.
Your server will get a lot of hits by subscribing to this webhook.
A simple idea is to send the Bot a message from an administrator account. For example, if the admin sends 'STOP' then the Bot stops sending messages until an admin sends 'START'.
The incoming events to the Bot contains the sender id. The sender id would have to be correlated to a particular administrator id. The only way I have found to get that id for a particular user is to send a message and print out the id. The id is specific for the Bot and user combination. For example, my Bot will send a message to my personal account with this JS line:
sendTextMessage(1073962542672604,fistName + " " + lastName + " " + messageText); // send a message to Matthew directly
Sounds like you have a bot working but if you need more details, have a look at my Bot and source code.
Just for fun, I added this functionality to my Bot. To see details in the node.js implementation, search for the 'isStopped' variable in the app.js script.
I'm building an app and the client wants the following logic:
User logs in to the app.
User selects a Friend.
User selects a gift that the User will send to his Friend.
User writes a message to his Friend.
Friend receives a SECRET notification about the gift.
With "SECRET" I mean that Friend will not be able to see WHO is the User that sent the gift.
So the concrete question is how to send a notification to the FRIEND without a clue about the USER that sent it? I think is not possible but I want to be sure and check with the experts.
And if it's not possible, what do you recommend to accomplish something like this? Should I use the app request dialog and hope that the Friend will see it? Is there any other FB API tool I can use?
I really appreciate your help.
What you're trying to achieve is not possible with FB's API. As explained already by #CBroe.
You can send a request notification if the user uses your app. However, You can do one thing but that won't be completely anonymous.
You can send the friend a notification from the user and make it just an invite to try the application and after the friend uses your app (authenticates), your app can then send a notification and say someone left a SECRET message for them. This could be after few hours or instant, Whatever you/your client prefers. However as i said, this won't be completely anonymous nor it's hard to guess who left the message unless the friend isn't smart enough to know who that could be.
With the beta Notification API something similar would be possible, but only if the receiver has authenticated your app: https://developers.facebook.com/docs/games/notifications/#impl
I've logged in and used the Facebook CHAT api all right. The problem is that I want to have a system where anyone can send me a message, without actually being on the friend list.
When the sender is in the friend list, I see the message. Is there a possibility that I can configure my account to receive messages from anyone, independing on if they are in the friend list or not?
Best Regards.
The Chat API and the Message API are not the same.
You may want to think of Chat as a subset of messages.
When a message is received and the user is a friend you receive a chat notification, if not, no response.
I have a page with a comments social plugin, I would like to know if it's possible to notify users who have already commented on the form.
I can subscribe to the comment.create function, but how do I send notifications?
I know actual notifications are now impossible, but is there another way? (Sending a message from the user perhaps?). With the format of my page, they will want to know when someone has posted.
I haven't tried that, it's just an idea.
https://developers.facebook.com/docs/reference/plugins/comments/ - look at the section describing way of getting comments via Graph API.
E-mail way:
You can ask each user who logs into your site to allow you to get his e-mail address. Then, you would subscribe to this event, list users who commented an article and send them an e-mail.
Message way:
You need a Facebook page for your site. Then you would receive a token for this page (manage_pages permission), get publish_stream permission in behalf of this page and publish message to streams of users who commented.
It may be also possible to send user a message on behalf of a page using Graph API, however I haven't seen anything like that in docs
This is not allowed by facebook, the attempt will result something like this:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException"
}
}
This is because the social plugins do not "live" inside facebook, they are being distributed to 3rd party sites, and to prevent bad content posted from bots/apps to display in 3rd party websites, facebook has disabled this option.
Search for WordPress Plugin called Ultimate Facebook Comments Email Notify. I hope it will solve your problem...and you can also take some idea from his script which he is using in the plugin....hope this helps :)