Bot integration with Dialogflow supports the following types of messages:
TEXT
IMAGE
DOCUMENT
MENU
QUICK_REPLY
Text message
To define a text response, simply select "Text Response" from the possible response options and type one or more messages.
Image message
To return an image as a response, first you need to add a channel that supports this type of response (eg. Facebook), then select the "Image" type response and configure it with the url that must be called to return the image.
The url can contain a link to an image on the internet or it can be a web service that returns an image.
It is also necessary to configure some parameters for correct image processing. Being able to return multiple messages, even of different types, for the same intent, the parameters must end with a number corresponding to the position of the response in the sequence of configured responses.
Property | Required | Description |
---|---|---|
messageType | YES | Indicates the type of response: in this case must be “image” |
fileName | YES | File name including extension |
caption | NO | Caption of the image |
Example
Response configured with an image, a text message and another image in this exact order.
Document message
To return a document as a response, we use Dialogflow “Image” response (eg. from Facebook or Telegram channel), with the url that returns the document and configured with the following parameters:
Property | Required | Description |
---|---|---|
messageType | YES | Indicates the type of response: in this case must be “document” |
fileName | YES | File name including extension |
Being able to return multiple messages, even of different types, for the same intent, the parameters must end with a number corresponding to the position of the response in the sequence of configured responses.
Example
Response configured with a text message, a document, a text message and another document in this exact order.
Menu message
Dialogflow provides the ability to return menus where each option results in a clickable button.
To create a menu, the "Card" type message is used (eg. from Facebook or Telegram channel).
The title of the card is used as the header of the menu, while for each single option the relative label and its value are configured, which can be a link to open a new page or a phrase which, if chosen as an answer, will be sent back to the bot.
Finally, if the configured option is a url, an additional parameter is required (that must end with a number corresponding to the position of the option in the sequence of configured options of the menu) called target, to specify where to open the link.
Property | Required | Description |
---|---|---|
target | YES | The target attribute specifies where to open the link. Possible values:
|
Example
Menu with 3 options: a link, a query for the bot and another link, in this order.