jellyfang / messenger-bot-tutorial Goto Github PK
View Code? Open in Web Editor NEWFacebook Messenger bot 15 minute tutorial
License: MIT License
Facebook Messenger bot 15 minute tutorial
License: MIT License
When committing changes to git, the guide mentions the command: git commit --message 'hello world'
referring to a path. Needs to be replaced with "hello world" instead?
Hello !
I followed the guide and console shows me the next message:
Error: { message: '(#100) No matching user found'
bot never response..
any ideas ?
thanks!
I have merged this bot into an existing node app, and everything works just fine (thanks a lot btw), except for when trying to "Postback" on the card.
It is just saying "typing" for like 10 seconds, then nothing.
Some debugging later (a la console.log(event)
) - I don't get a postback event at all
Hello,
I followed the tutorial, and got a nice bot working, but I have a question: when someone opens a conversation with the bot from mobile, a loading indicator is displayed continuously, until the person sends the first message. Is this normal?
And secondly, can I get a request when someone opens the conversation for the first time? So basically, I want the bot to be the one that sends the first message, and not wait for the person to write.
Not sure why, everything is setup but other people, not admins, are unable to chat with the bot. i've made the app public in Facebook developer "App Review" but I havent completed my submission. Do I need to do that first?
The URL couldn't be validated. Callback verification failed with the following errors: HTTP Status Code = 404; HTTP Message = Not Found
Hey there, thanks for this nice tutorial. :)
Everything is crystal-clear, but there is one thing I really can't figure out:
How can I make use of those Payloads instead of just messaging back the Payload name?
For example sending a generic card instead of the text message.
Looking forward hearing from you.
All the best!
I am getting changes{[]} and also object:{'page'} but not receiving the messaging field
My issue is with setting up the app page.
When I try to setup the webhook url, it doesn't work.
More specifically, when I used create heroku to create my heroku app the following text appeared
"Creating app... done, ancient-lake-88699
https://ancient-lake-88699.herokuapp.com/ | https://git.heroku.com/ancient-lake-88699.git"
So I assume that my CallBack URL should be "https://ancient-lake-88699.herokuapp.com/" or "https://ancient-lake-88699.herokuapp.com/webhook/"
I tried both but I kept getting the error message "The URL couldn't be validated. Callback verification failed with the following errors: HTTP Status Code = 503; HTTP Message = Service Unavailable"
It's bizarre because I went to my heroku dashboard and I can see a tab for "ancient-lake-88699" so I don't understand why this error is happening.
HELP ME! please...
I attached images of my command prompt and heroku dashboard.
And the next problem is how to "Add a function to echo back messages"?
:(( gives 404 :((
I want to send "send to messenger" button to my users in the mail. Is this possible? If yes then how can I achieve it?
As "send to messenger" button is an iframe, will it be possible to send it? @jw84
Hello using these steps, getting responds only using from my id, not any other peoples ID , any idea why?
I am making a simple reminder/to-do bot, just for fun. I wanted to know if bot can start a session(or conversation), say to remind me for a todo, at a cron event. I have been looking at various ways, couldn't yet figure out a way to do it.
I followed the sample and got it working. Whenever I message the bot it echoes it. However when I asked other people to message the fb page there is no reply. Is your sample supposed to work with other users other than the one who created the fb page? If yes then I did something wrong which I'm thinking is because the fb page access token I put in Heroku config vars is only applicable for my user, is that correct?
I have used switch for word processing:
swith (text) {
case 'I love you':
//do anything
break;
case 'love you':
//do same anything
break;
}
please help me merge this case
Hi, I have created my bot and it is working like a charm. I want to know the facebook ID of the person who is contacting my bot.
event.sender.id
is returning ID of my facebook page. I need to know the ID in order to know the name of this person and some other info so that I am able to process his request.
Can u help plz.
Hello,
I have an action called saveAddress.
Inside it, I call an API to save an address entered by Facebook user.
My problem is that I can't get user's input inside action function.
['saveAddress'](sessionId, context, cb) {
saveAddress(context._fbid_, 'ADRESS ENTERED BY USER')
.then(response => {
context.success = response.success;
cb(context);
});
},
I'm sure there's a way to achieve it.
Do you have a solution ?
Thank you.
Facebook now requires connections over https, which seems to mean you need an SSL certificate involved to use the messenger bot platform. May be out of scope of this tutorial, but worth mentioning. Through your tutorial, here's the error I received from FB:
The URL couldn't be validated. Callback verification failed with the following errors: curl_errno = 51; curl_error = SSL: no alternative certificate subject name matches target host name 'professordex.heroku.com'; HTTP Status Code = 200; HTTP Message = Connection established
hi, please help me.
I couldn't solve this error.
Response does not match challenge, expected value="1557258512", received="Error, wrong token"
callback url is https://hogehoge.herokuapp.com/webhook/
token is MY_VERIFY_TOKEN
i read another issues but i still couldn't solve.
Cloned the tutorial and everythings working apart from when you send a message of "Generic" it does nothing, it shows the message has been read but the app doesn't respond with the postback
Hi, do you heve any idea why bot works with only current facebook account which created facebook page and api. Api doesn't work when another user send a message.
While creating webhook, I am getting following error.
The URL couldn't be validated. Response does not match challenge, expected value="XXXXXX", received="hello world i am...". Can anybody tell why I am getting this. I have setup everything as told.
In GitHub page images are not displaying.
I have setup the code and server as per the tutorial. I am a beginner and doing this for the first time. Everything else went through smooth but at the end, I am not able to start the app in Heroku. Find the logs below. Tried to find a solution to this but nothing worked. Let me know how to move forward.
2016-06-28T22:06:50.650511+00:00 app[web.1]: running on port 9507
2016-06-28T22:06:51.223817+00:00 heroku[web.1]: State changed from starting to up
2016-06-28T22:06:52.024520+00:00 heroku[web.1]: Process exited with status 143
2016-06-28T22:40:18.932651+00:00 heroku[web.1]: State changed from up to down
2016-06-28T22:40:22.872312+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-06-28T22:40:25.280503+00:00 heroku[web.1]: Process exited with status 143
2016-06-28T22:06:45.799997+00:00 heroku[web.1]: State changed from up to starting
2016-06-28T22:06:45.799459+00:00 heroku[web.1]: Restarting
2016-06-28T22:06:47.585613+00:00 heroku[web.1]: Starting process with command node index.js
2016-06-28T22:06:52.024520+00:00 heroku[web.1]: Process exited with status 143
2016-06-28T22:40:18.931934+00:00 heroku[web.1]: Idling
2016-06-28T22:40:22.872312+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-06-28T22:06:45.799997+00:00 heroku[web.1]: State changed from up to starting
2016-06-28T22:06:49.863178+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-06-28T22:06:50.650511+00:00 app[web.1]: running on port 9507
2016-06-28T22:06:51.223817+00:00 heroku[web.1]: State changed from starting to up
2016-06-28T22:40:18.931934+00:00 heroku[web.1]: Idling
2016-06-28T22:40:22.872312+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-06-28T22:06:45.799997+00:00 heroku[web.1]: State changed from up to starting
2016-06-28T22:06:47.585613+00:00 heroku[web.1]: Starting process with command node index.js
2016-06-28T22:40:18.932651+00:00 heroku[web.1]: State changed from up to down
2016-06-28T22:40:22.872312+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-06-28T22:40:25.280503+00:00 heroku[web.1]: Process exited with status 143
I DON'T UNDERSTAND THIS!!!!!!!
You can also skip the whole thing by cloning this git repository here, running npm install, and run a server somewhere. MAKES NO SENSE
NOT A TUTORIAL, WHICH MAKES YOU A RETARD!!!! :D
Hi how to work with API's, please let me know
Hi all,
i'm a newbie to programming and following the instruction to install both heroku and node.
I'm facing an issue that when i type sudo npm install npm -g into node Command Line Prompt. It show that there's syntax error.
Could anyone help to solve this issue? I tried to search this issue in google but couldn't figure out anything.
thanks and appreciate for your help.
I would like to know how to show greeting message when start conversation, without waiting for the user message.
I follow every step but when I put the callback URL and Verify Token I have an error message : the url couldn't be validated. Callback verification failed with the following errors: HTTP Status Code = 503; HTTP Message = Service Unavailable.
There is a way to fix it?
Thank you.
Hi Jerry can I understand why you are not replying dispite taking our project. The fact that you are making commit here means you are alive and well. We have fees paid to you please at less provide the code or refund our fee
Got stuck at the Token access on the terminal. Has this error message:
error":{"message":"Invalid OAuth access token
For some reason, it won't take the token from Facebook that I generated. Is there a step that I missed or did incorrectly to cause this?
Hey there,
I followed every step of the tutorial until "4. Go to the Facebook Page and click on Message to start chatting!" and now I have the following problem:
Every time I am messaging the Bot, I will get the following error in the Heroku Application Logs:
2017-01-11T17:24:45.471413+00:00 app[web.1]: Error: { message: '(#230) Requires pages_messaging permission to manage the object',
2017-01-11T17:24:45.471423+00:00 app[web.1]: type: 'OAuthException',
2017-01-11T17:24:45.471424+00:00 app[web.1]: code: 230,
2017-01-11T17:24:45.471424+00:00 app[web.1]: fbtrace_id: 'ABwdzh7Rhfl' }
I am both admin of the fb-page and the app.
I hope somebody can help me with this.
Thanks in advance and have a great day! :)
Hi,
It's not possible to use localhost url ? Because push for test is very not attractive.
Do you have a solution for that, to use reserve proxy ?
Thanks
Please help me more
because the tutorial uses commands and i didn't get the actual effect of the command.
For example when i run this command
curl -X POST -H "Content-Type: application/json" -d '{
"account_linking_url": "ACCOUN_LINKING_URL",
"persistent_menu": {
PERSISTENT_MENU_SETTINGS
},
"target_audience": {
TARGET_AUDIENCE_SETTINGS
}
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=PAGE_ACCESS_TOKEN"
i got this message
{"result":"success"}
but i didn't get the actual effect in my bot.
So please help me, I am a beginner at building bots :D
Hi there,
I'm not receiving any reply from the bot. is there any tip that you can share in order to make it work ?
I've set up the bot and everything is correct but I cannot receive the echo reply.
Thank you.
Since this is something a lot of people might use to start their work on, it would be cool if you could add a permissive license.
Have this trouble when running
web: node index.js
Thanks
Great tutorial! The only thing I noticed was that in the README, the curl command to trigger the Facebook app to send messages in Step 4 may require the "-ik" or "--insecure" flags. I had some issues with curl saying it could not return a cert otherwise. But add the flag, and all's well. :)
Trying to register facebook webhook and keep getting error listed below .BTW I changed in index.js from FB_PAGE_ACCESS_TOKEN to PAGE_ACCESS_TOKEN
"The URL couldn't be validated. Response does not match challenge, expected value="492837124", received="hello world i am a..."
I created these config on heroku
PAGE_ACCESS_TOKEN
VERIFY_TOKEN
Getting this error message when I am trying to use the CURL command
{"error":{"message":"Invalid OAuth access token.","type":"OAuthException","code":190,"fbtrace_id":"DPBNtgEihPS"}}
I want to customize the "send to messenger" plugin button similar to this .
Is there any documentation available to achieve this?
In this line:
qs: {access_token:token},
you're sending a random generated token. Shouldn't this be the page access token which you use to subscribe the page to webhooks?
Hey Jerry,
I am getting the below error even though my heroku app is accessible. Please help!
The URL couldn't be validated. Callback verification failed with the following errors: HTTP Status Code = 502; HTTP Message = Bad Gateway
Thanks.
I am unable to link the app to the web hook by following this tutorial or even cloning the repository. there are 2 issues:
'])
I add your code but I can't make bot could reponse my message.
Demo:
https://www.facebook.com/quynhbkhn/posts/1069994366404542?comment_id=1069995923071053¬if_t=feed_comment¬if_id=1461168660906242
please help me.
My code:
http://paste.ofcode.org/NdmfRnbrknGBdrEMJZSqDY
Hi jw84,
First of all, thank you for all your hard work
Is there a way to know if it's the first time a user contacts the bot ?
I'd like to call the function below to greet the user
function sendWelcomeMessage(sender) {
messageData = {
text : "Hello, first message"
}
request({
url: 'https://graph.facebook.com/v2.6/me/thread_settings',
qs: {access_token:token},
method: 'POST',
json: {
recipient: {id:sender},
message: messageData,
}
}, function(error, response, body) {
if (error) {
console.log('Error sending messages: ', error)
} else if (response.body.error) {
console.log('Error: ', response.body.error)
}
})
}
When I send any message to my bot I get this person isn't available under my message. Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.