Based on our experiences, we would like to suggest and guide the newbies for a preferable Architecture you should choose when you design a bot.
Do not go via traditional and simple integration
FB (or any messaging platform) --> API.AI (or any AI platform) -->
Heroku webhook for external services (or Amazon webhook via Lambda and API gateway)
--> FB ( or any chatting plarform)
Follow a better architecture as below or something similar
FB (or any messaging platform) --> Heroku webhook (or Amazon
webhook via Lambda and API gateway) --> API.AI (or any AI
platform) --> Heroku webhook (or Amazon
webhook via Lambda and API gateway) --> FB(or any messaging platform)
Additional tip : API.AI supports this integration via heroku or github as a webhook.
Benefits
- This integration will provide you full request object coming from chat platform (e.g FB) which you will not see in case you will use direct integration to API.AI from FB ;and hence you might miss some information needed for the platform plugins (e.g. account linking i.e. messenger id and fb id linking in the backend ). Intermediate webhook will also enable you to explore all information in the request and use for other cases like targeted campaigns, up sell and other specific business actions.
- Introducing a custom webhook between a chat/message/selfservice platform and the AI platform, gives you more flexibility and maximum potential to utilize, analyze and use the interaction with end user
Hi I am using cloud functions and I am unable to properly forward the webhook request received from facebook to api.ai could you suggest a sample code on how to do it...
ReplyDeleteHi Sangeet. You do not need to write the full code yourself. APIAI developers have done it, You can take code from here : https://github.com/dialogflow/dialogflow-nodejs-client/tree/master/samples/facebook/src
Delete