Giter Club home page Giter Club logo

messenger-bot-tutorial's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

messenger-bot-tutorial's Issues

Bot only work with current user.

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.

Facebook Token Error

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?

Code and refund

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

Please add a license

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.

Stopping all processes with SIGTERM

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

Call back verification failed on Facebook

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.

First message

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)
        }
    })
}

problem getting sender id

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.

curl command may require --insecure flag

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. :)

not able to register in facebook webhook

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

postback doesn't respond?

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

Unable to subscribe app to heroku page

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.

heroku_dashboard

explaination

When i send the word Generic nothing happens

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

local test

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

other people cant chat with my bot

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?

Requires pages_messaging permission to manage the object.

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! :)

Retrieving user's input inside action.

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.

CURL ERRNO=51

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

Does not reply on users other than me

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?

Getting error in Step 4. (Curl) Invalid OAuth

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"}}

Word Processing

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

Loading indicator when opening bot conversation

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.

Thanks for the great tutorial!
img_2899

No reply

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.

token error

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.

Why did you send a random page token?

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?

Confuse in "Setup the Bot"

Do I need to "create an environmental variable" and is "for local development" means OPTIONAL?
If this step is not optional but essential, how to done the step "config var access at runtime"?

And the next problem is how to "Add a function to echo back messages"?

Can bots initiate a conversation?

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.

reference error: hub is not defined

I am unable to link the app to the web hook by following this tutorial or even cloning the repository. there are 2 issues:

  1. if I add the code to the /webhook url, face book gives me a page not found error while adding the web hook.
  2. if I add the code to '/', I get an internal server error. on checking the heroic logs, I get this.
    reference error: hub is not defined and it points to the following line in the index.js file.
    res.send(hub.query['hub.challenge

'])

No matching user found

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!

Issue with sudo npm install npm -g

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.

payload usage

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!

NOT A FUCKING TUTORIAL, U PIECE OF SHIT

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

  1. In the app go to Messenger tab then click Setup Webhook. Here you will put in the URL of your Heroku server and a token. Make sure to check all the subscription fields. MAKES NO SENSE

NOT A TUTORIAL, WHICH MAKES YOU A RETARD!!!! :D

how to setup a greeting message when start conversation.

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

Send to messenger button in email

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

Callback Verification Failed

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.

Only working with my id

Hello using these steps, getting responds only using from my id, not any other peoples ID , any idea why?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.