I am running into a problem with FB messenger bot. Here is what is happening:
I have one app ( I want to use the same APP_SECRET)
I have two pages with different names
I have two different bots - one per page
I have one server / webhook
When I send messages to each of them, they work fine. I am using Generic template for both - with buttons.
When I select any button on the first bot, it works - gets post back event
When I select any button the second bot, webhook doesn't even gets called
If I swap the bots (first with second), I see the same behavior, new first bot gets post back events and the new second doesn't.
Any idea if this is a problem with FB Messenger framework? Or any suggestions.
Can you please provide the snippet in which you handle the postback events?
I think I can help since I've managed to run 5 bots on the same webhook.
Related
I built a chatbot that I plan to use with my pages. It's nothing special, only for development purposes. I used fastapi + mongodb + RASA NLU. It's all working fine with the integration by creating the app and subscribe to the webhook. the only problem I have is that I need to create one app per page. How can I link my chatbot to my page without creating an app all the time? I noticed ManyChat and ChatFuel can do this but I'm lost the fb developer documentation.
for reference, here's my current webhook setup.
https://myapp.com/webhook/<pageid_01>/
https://myapp.com/webhook/<pageid_02>/
https://myapp.com/webhook/<pageid_03>/
it's a workaround, of course. it works but I don't really want to maintain too many fb apps. not that I have many but between me and my friends who want to use my chatbot, it's not a pretty sight.
You can use the same webhook to handle events from multiple pages, but i don't think there is a way to make one fb messenger app for multiple pages! because the app will be receiving page-scoped unique Ids
You can just connect multiple pages to same app. And when you receive the event on your webhook, you can check the page-id and based on page-id, perform that page specific actions.
I've got a FB page, that I used on a bot creation platform, then I use it for another bot creation platform.
What I expected was FB to cancel the previous subscription before setting the second one but looks like no.
I always get 2 responses, one from each of the platform.
I'm testing a handmade webhook, now and I'm getting 3 responses, the previous 2 ones and mine.
Is there a way to make FB drop the 2 first webhooks ?
By going to your page Settings and then Messenger platform you can uninstall any applications you do not wish to receive postbacks and/or send messages.
I have done few things with the facebook. And one of the easiest is what you are asking for.
So go to https://developers.facebook.com
Log and find you app
Go to webhooks
There are listed all the webhooks and next to each of them there is a button "Unsubscribe"
It is working without any verifications etc..
It's not very clear to me and perhaps other devs as well. I've read the Facebook Messenger docs maybe 5 times and I can't understand how bots detect when a user enters their chat window.
I started by looking for a postback, when users entered the bot experience. No Postbacks. I looked to see if it was Messenger Greeting, and that seems to only apply the first time a user arrives in your bot experience. This also seems a little different.
It's possible this functionality is not available to everyone. But Poncho has done this several times when I enter their experience and don't type anything.
Anyone seen this or have any ideas?
The postbacks are something completely different. The postbacks are received only when a user clicks on a button which contains a payload mentioned in the payload element of your button template or structured message. Facebook chat bot API sends this payload back to let you know that the user has clicked on a particular button.
What you're looking for is called Welcome Screen and you're right, the default behavior was not clearly listed in the documentation. But one of the Facebook engineers cleared the doubts for me and now they have edited the documentation. The welcome screen appears once and only once for a user on the messenger app i.e the first time when the user interacts with your chat bot even if the user deletes the conversation. From the docs:
The Welcome Screen only appears for new conversations. On mobile,
deleting conversations will not cause the Welcome Screen to appear
again. On desktop web, if you delete the conversation, you can make
the Welcome Screen appear again.
Where as, the behavior is different for the regular Facebook chat in a web browser. A user can see the Welcome Screen in the regular chat if he/she deletes the conversation.
There's no way to detect that the user has just entered the bot experience. I've tested Poncho bot before and I don't get any message when I enter the bot experience after the first conversation.
There's a possibility that you're experiencing this because of Watermarks. Watermarks are received on our webhook when a message is delivered and read by the user. May be they are handling watermarks in such a way that if the timestamp that comes with the watermark is few hours late than the current time, they send the message. You can read further about watermarks in the official documentation here and here.
I am trying to make a FB app which does the following:
i) The app is present on the page Tab. When the user click the pageTab, she is shown a screen[A1] where she can invite her friends to this app.
ii) When the friend gets the notification, she sees another screen [A2] which tells about the app.
What are the ways to do this?
I was wondering if there is a way to identify the source of the requests (other than the url on browser) to differentiate between the two requests to the Apps so that I can render the appropriate screens [A1] or [A2] based on if it is clicked from the PageTab or directly the invite notification.
Thank you.
See https://developers.facebook.com/docs/requests/, section „Accepting a User Request” – your app will get the request id(s), and can then read out the details of the request(s).
If the pure fact that the user came by your app following a request notification isn’t enough for you in your scenario, you can also pass an additional data parameter while making the request, read that out when processing the request, and let your app react accordingly.
And remember that it is your responsibility to delete requests once the user has acted upon them. (Also described in detail in the documentation.)
I have created Facebook pages with an events tab. I am currently trying to add events to this events page via the Facebook connect API but can't work out how do it.
I can add events to my profile no problem.
Can anyone tell me how to add events to a page, is it possible?
Alternatively is there a way I can add an event to my profile and have my page automatically pick up this event (I can't see anything in the settings for this?).
Any help very much appreaciated!
Thanks
C
Current API doesn't support this as far as I can see.
There is an API function which is in beta at the moment (but doesn't seem to be working as
yet) which according to the documentation is designed to publish a post into the stream on the wall of a user, group, page or event, so this should provide the functionality needed.