I have created a Dialogflow messenger bot by integrating it to Facebook. Now FB send a request to Dialogflow and Dialogflow send the response to FB.
FB --> Dialogflow
Dialogflow --> FB
I want to put my server in the middle process. So that FB request will come to my server and my server will send a request to Dialogflow.
FB --> My Server --> Dialogflow
Dialogflow --> My Server --> FB
Is this possible? If so is there any PHP libraries or tutorials I can use?
Dialogflow supports sending data to servers.
You'll need to go to the Fulfillment tab to your project and enable Webhook
There you can set up the URL for where it should send the data including headers and authentication between your server and Dialogflow
Once you connect Dialogflow to Facebook all conversations will be routed through Dialogflow so the webhook is your best chance to do the communication. After that you just return a response to Dialogflow and it will send it for you
You can read more about Fulfillment from the documentation from Dialogflow: https://dialogflow.com/docs/fulfillment
For Future Readers this is the way I found to fulfill my requirement.
In here I want my server to act as the middleman and identify the intent.
FB --> My Server --> Dialogflow
Dialogflow --> My Server --> FB
In Dialogflow v2 you can use the DitectIntent to identify the Intent.
https://dialogflow.com/docs/reference/api-v2/rest/v2/projects.agent.sessions/detectIntent
The SDKs available for different programming languages are available here. https://dialogflow.com/docs/sdks#detect_intent_and_agent_apis
Related
I have a Dialogflow agent which is integrated in an app and a web version. I want to integrate this chatbot with Chatbase to get analysis metrics of the bot. However, as of chatbase documentation we cannot integrate Dialogflow hosted bots with Chatbase but if I have a server in the middle of my app and chatbot which is saving all the data, can I integrate chatbase with it?
The typical way to integrate Chatbase is to have it called as part of fulfillment. This requires you to set each Intent to use fulfillment, but you can still set the reply as part of the Intent, if you wish. In your webhook, you would call Chatbase to record the event, but not return any response in the webhook, and Dialogflow will use the Response set in the UI.
Chatbase reports are built upon user messages and intents, however there is value in sending us the bot messages to provide context to the Transcripts feature. You can create a server to server integration to send us the JSON payloads in real time, or in batches of up to 100.
I tried looking all over the internet on how to setup and send text message(sms) through Dialogflow.
I am building an app where the Bot asks the user for their number and sends them a text message. Is there a tutorial? or anyone guide me I appreciate it?
As suggested by Nikhil, you need to use twillio APIs to send the SMS.
Here is how it will work:
Dialogflow will ask user for phone number and store it in a parameter
Dialogflow will pass the phone number to the Webhook
The Webhook will make an API call to the Twillio API with above phone number
Twillio will send the sms
Webhook can return some success message to the Dialogflow
Dialogflow will return the message to the user.
Here is a link to the tutorial I have created for understanding dialogflow webhooks: https://www.youtube.com/watch?v=1cD9vU7Ubyg
You can refer to this link for sending sms in PHP via Twillio: sending sms via twilio in php
It appears that Dialogflow can only respond to what's tweeted at my bot. Is there anyway to get it to respond to non-# my bot tweets?
Dialogflow's built-in Twitter integration works with #-tweets and DMs.
To handle arbitrary tweets, you would have to write your own Twitter integration using the Dialogflow API and Twitter API, calling the detectIntent endpoint for each incoming tweet and posting the response via Twitter's API.
I have a case where I need to create a Bot in Slack that my users can use conversational language to get information out of my web app in real time. The scenario goes something like:
User asks the bot something like: #hrbot How many employees are in the Finance department?
Bot send the string to API.AI/ diagflow to resolve into a JSON request
API.AI sends the JSON request to my Web App endpoint via webhook to get the answer
Answer is returned to user's Slack channel
Question:
1. How do I get the auth token from api.ai to send message to slack?
With Dialogflow (formerly API.AI) you provide a webhook (a HTTPS URL where your server is) and Dialogflow will send a HTTPS request to your webhook when requests come to your Dialogflow agent. You can enable the Slack integration in your Dialogflow agent through the web interface and all requests from Slack will be sent to your Dialogflow agent and (if you configure it) to your webhook with NLU information and the original request from Slack.
Information about the request that is sent to your webhook is documented here: dialogflow.com/docs/fulfillment#request if you respond to the request the response will be forwarded to the user that trigger the request. The response format is documented here: dialogflow.com/docs/fulfillment#response
I require to send messages asynchronously from my service to api.ai and then api.ai would send it to Facebook Messenger.
To achieve asynchronous messaging I have used custom events.
But on using custom events, events are getting triggered from webhook, and messages are going to api.ai but it is not further displaying anything to facebook messenger
Probably you want to add a delay before api.ai replies to user input, right? Than you need to add a delay in your Facebook integration app.
Consider the follow flow
User type a message in Facebook messenger window
Facebook sends the message to your integration app
Integration app sends the message to api.ai
Api.ai responds to the message and send the reply to the integration app
Integration app wait for a while and than sends the reply to Facebook
Regards