I am creating a facebook bot i used chatfuel to create the bot,i send all the replies of the user to my server using Json API because” i want to pass data retrieved from the user’s message to my Json API to get/add data from/to my database
for example:
user reply:
my name is Peter
i want to send “Peter” to my api and add it in my database using get or post request “
i was told here to use wit.ai:
https://community.chatfuel.com/t/send-variables-from-the-users-message-to-the-json-api/4406
I would like to link my php server which is connected to my database with wit.ai to create the AI for my Bot.
I need detailed steps to follow or a simple template.
Any simple information would help a lot
Thanks
Question posted in Facebook API
The official documentation for the Facebook APIs can be found here.
The official documentation for the Facebook APIs can be found here.
2
Answers
It looks like you want to use Wit.ai for Entity extraction. The entity being the contact’s name. In your example, this will be Peter.
Wit have an HTTP API you can use.
https://wit.ai/docs/http/20160526
First, create an app in Wit. Then have your PHP application pass on the message to the Wit API.
You can get the ‘BEARER_TOKEN’ from the app settings.
The API will return JSON output with the entity and a confidence score.
You should then be able to take the entity from the JSON output and add to your database.
To follow on from Bcf Ant’s comment above – here’s how to do the call in PHP. Put the string you want to parse in $input_utterance and replace XXXXXXXXXXX with your token ID: