facebook messenger bot does not reply automatically - node.js

I went thru all the documentation at: https://developers.facebook.com/docs/messenger-platform/quickstart and my fan page does not reply to when receiving a message conversation.
When I logged in and start conversation I get a notification on the fan page which says: Authentication successful, Sent by bot... So basically there seems that something is working... But when I type 'hello' nothing comes back from the fan page.
I dont know what I am missing, just so u know I am using this code from this repo: https://github.com/fbsamples/messenger-platform-samples/tree/master/node

Related

Facebook Messenger Chatbot messages tagging (of sorts)

I have a Facebook Messenger bot (written in NodeJS) and a separate control panel where a user can manage the information that the bot is working with (like inventory stock, etc.). One of those things is a log of all conversations between the bot and a visitor. The control panel allows the admin users to send messages to visitors through the bot. There is an input box where they can type in a message and when they click 'Send', the message goes to the bot app, which then sends it back to the user through Send API.
Messages are logged into a database; those going to the bot (from the visitor) are logged when they're received, and those the bot responds with are logged through the 'echo' callback.
The problem with this is that the bot can reply to certain visitor commands (phrases) and tries to perform certain actions based on the input. I'm using Wit.ai for this, but due to the scope of the possible phrases and keywords, the default mode when someone sends a text message is to send it to Wit.ai for processing. However, if an admin user sends the visitor a message from the control panel, the visitor could want to respond to that message (instead of sending a bot command) and that response should not go to the Wit.ai for processing. And due to the sheer scope of possible variations of what can be said, coupled with the fact that they can actually use some of the keywords in the response as well, processing the intent with Wit.ai in that case is too uncertain.
I was wondering if there's a way to somehow identify/mark the source of the messages that the bot sends to the visitor, so when an echo callback comes, I can know if it's, say, from a regular bot routine or from a user-entered reply. Like some additional meta tags that could be sent with the message that would also get returned with the echo, but that doesn't pollute the message itself. Is something like that possible? Or is there a different way I can achieve the same result.
I don't wether that helps you, but Facebook just recently integrated a quite mysterious Tag feature for bots.
https://developers.facebook.com/docs/messenger-platform/send-api-reference/tags

How to detect bot message/user message?

My FB-NodeJS-API prototype is not working correctly because my webhook is receiving the bot respond which is then sent to API.AI.
I need to set a condition where only a user's message should be received on the webhook request or only user's message should be sent to API.AI.
Can anyone advise me on this?
Can you explain the problem better? Please add the relevant code.
The bot response should go the user, not the webhook. The user input will come to the webhook.
I would suggest getting the bot to work without API.AI first and then adding support. My bot is in node.js so you may just want to jump to the source code.
For more information on setting up a bot see my article Facebook Bots for Fun and Profit
The example bot is DMS Software Bot
The source code is Github fb-robot

Facebook Messenger :How to show a greeting message when start conversation

I want to show a greeting message when start a conversation on Facebook Messenger ( before any user input ) . How to do it?
The problem is : My code is for server by NodeJS ,and it only trigger when a message is send to server ,which mean it only be triggered when users send something.
Facebook messenger doesn't send anything when you press button "Message".
I have check this link Messenger Greeting , but it only shows when a new user starts chat ,but i need show it when starting conversations
You have to set a welcome message, using the Facebook Api.
Find the documentation here: https://developers.facebook.com/docs/messenger-platform/implementation#welcome_screen
As explained in the documentation, you have to make a POST request to https://graph.facebook.com/v2.6/<PAGE_ID>/thread_settings?access_token=<PAGE_ACCESS_TOKEN>
You need to make the POST request only once, then Facebook will automatically prompt your welcome message whenever a user starts a chat.
I wrote and answer for this question here.
Have a nice working ;)

Telegram Bot webhook really slow

I've created a telegram bot and set a webhook as described in the docs. For testing purposes I've set it up so once you send the bot a message it replies back with the same message.
Now the issue I am having is that the updates from telegram are coming back really slowly and there are some messages I haven't received yet. Am I missing something or is the webhook method just really slow?
I had the same problem. Turns out I wasn't responding the telegram server after I got the POST request. Due to this, the server wasn't sure if I got the previous updates and was constantly sending my webhook past updates.
I have an express server and I added this bit of line after handling the POST Request.
res.sendStatus(403)
You can also confirm this by going to this url
https://api.telegram.org/<token>/getWebhookInfo
You'll see a property called pending_update_count. It should zero or close to it.

Getting onStartChattingMessage to fire in a Kik bot

I have been playing around with the Kik bot framework using Node and have a bot to chat with. I am using the onTextMessage event successfully, but have yet to get the onStartChattingMessage to fire. The docs are not very detailed, any idea when this gets invoked? I thought it would be when I start a new chat with the bot but that doesn't seem to be it. Or I am just holding it wrong. Code is on GitHub at https://github.com/jcapka/otherword/blob/master/server.js
Per https://dev.kik.com/#/docs/messaging#start-chatting this only happen
Under normal circumstances, you will receive this message once
when user that starts chatting with you for the first time.
If you are trying to get it to work but using the original username you have already chatted.
You'd have to make a new account to be able to get the first-time experience and have that StartChattingmessage
As an example I went and messaged your bot and I got this response `

Resources