Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to setup a greeting message when start conversation. #31

Open
dromerobarria opened this issue Aug 23, 2016 · 3 comments
Open

how to setup a greeting message when start conversation. #31

dromerobarria opened this issue Aug 23, 2016 · 3 comments

Comments

@dromerobarria
Copy link

I would like to know how to show greeting message when start conversation, without waiting for the user message.

@maheshambiga
Copy link

maheshambiga commented Sep 12, 2016

There is a separate API to do this.
Refer to, Thread Settings

@FehrHassan
Copy link

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

@maheshambiga
Copy link

Please see the sample code written for NodeJS below,

import express from 'express';
var app = express();

app.post('/webhook', function (req, res) {
threadSettingsAPI();
}

function threadSettingsAPI(){
var messageData = {
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":JSON.stringify({
action:"GET_STARTED",
params:{}
})
}
]
};

request({
    url: 'https://graph.facebook.com/v2.8/me/thread_settings',
    qs: {access_token:process.env.PAGE_ACCESS_TOKEN},
    method: 'POST',
    json: messageData
}, function(error, response, body) {
    if (error) {
    } else if (response.body.error) {
        console.log('Error: ', response.body.error)
    }
})

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants