I am trying to create a simple answer bot fo my facebook page but am kind of lost as it it my first try.
I have integrated the webhook on my website and this is the file at the end of my Callback URL:
<?php
$challenge = $_REQUEST['hub_challenge'];
$verify_token = $_REQUEST['hub_verify_token'];
if ($verify_token === 'YOURVERIFYTOKEN'){
echo $challenge;
}
?>
The webhook is set up but I have no clue what should be my next step ? How could I set up a welcome message ?
You're meant to be able to do it by posting to this API:
https://graph.facebook.com/v2.6/<PAGE_ID>/thread_settings?access_token=<PAGE_ACCESS_TOKEN>
with a payload like this:
{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"message":{
"text":"Welcome to My Company!"
}
}
]
}
This has worked for me in the past but I'm currently getting validation errors when I try. I've opened a bug with the facebook platform team.
Update
To set a welcome message you send the following payload to the above URL:
{
"setting_type":"greeting",
"greeting":{
"text":"Timeless apparel for the masses."
}
}
as per:
https://developers.facebook.com/docs/messenger-platform/thread-settings/greeting-text