Dialogflow Information

Knowledge Base

Knowledge Base are automatically enabled. Knowledge Base is a feature that gives your chatbot the ability to search within documents (such as a PDF) or web pages to find an answer. To create your first Knowledge Base, go to cloud.google.com/dialogflow/docs/knowledge-connectors

Dialogflow response

The full Dialogflow JSON response is automatically saved in the database, sb_messages, column payload.

User attachments

User attachments are sent to Dialogflow by appending the attachments to the message details in the following format:

[name:file-name.ext,url:URL,extension:file-extension]

Example:

[name:archive.zip,url:https://chat.ebot365.com/archive.zip,extension:zip]
[name:license.pdf,url:https://chat.ebot365.com/license.pdf,extension:pdf]

Bot attachments

To allow the chatbot to send attachments, add a Custom Payload response and insert this JSON code:

{ "attachments": [["name", "YOUR-LINK"], ["name", "YOUR-LINK"], ["name", "YOUR-LINK"]]}

Replace "name" with the actual name of the attachment to display and replace "YOUR-LINK" with the actual URL of the file. Images attachments are displayed automatically as images.

Rich messages

To allow Dialogflow to send rich messages, simply enter the rich message shortcode into the TEXT RESPONSE field or add a new Custom Payload response and insert this JSON code: { "rich-message": "shortcode" }. Replace “shortcode” with the rich message shortcode, to have a valid JSON code you need to replace all " chars with \". To obtain the shortcodes or to learn how to create a rich message, please click here.

Rich message response

When the user interacts with rich messages via the EBOT365 chat (e.g. by clicking a button), the rich message response is sent to Dialogflow in the following format: ID|response, or ID if the rich message type is registration, email, follow up, in this case the rich message values are sent as array in the queryParams['payload'] key. ID is the rich message ID, which can be set by adding the attribute id="YOUR-ID" to the shortcode. If no ID has been set, a random ID will be used instead. response is the input or selection of the user. To block Dialogflow from replying to a rich message add a new intent with ID as the only user expression and no response.

If the user is interacting with the chatbot via a messaging app (e.g. WhatsApp), the response of the rich message does not contain the rich message ID and Dialogflow contexts must be used to allow Dialogflow to understand which Intent to activate for a specific rich message response.

Get rich message response for registration, email, follow up

From Left menu > Fulfillment enable Webhooks, you only need to enter the URL of the file that will receive the Dialogflow webhook data.

Create an Intent with the ID of the rich message, for the registration form, enter registration, for the follow up form enter sb-follow-up-form, for email forms enter email.

Enable the Fulfillment for the Intent

You’re done! The file of the webhook URL will receive the EBOT365 rich message user details.

Dialogflow chatbot optimisation

If the chatbot is replying with the wrong intents, go to Dialogflow Console > chatbot Settings > ML Settings, and set the ML CLASSIFICATION THRESHOLD to a larger number, such as 0.6.

Sequential survey

To create a sequential survey like the one of the demo you need to Enter the Rich message ID in the Training phrases, check the example below.

Go to Dialogflow and create a new intent. In the Training phrases area enter the user expression survey example. In the Responses area enter the code [buttons id="test-survey-1" options="Software,Physical products,Services" title="What is your type of business?" message="Please choose the type that best suits your company." success="Your company type is "]

Create a new intent. Enter the user expression test-survey-1 and as response enter [select id="seq-survey-2" options="Priority post, Express courier, International courier" title="Shipping methods" message="Choose the preferred shipping method of your customers" success="Your customers preferred shipping method is"]

Create a new intent. Enter the user expression test-survey-2 and as response enter Thank you for completing our survey!.

You’re done.

Bot training

Agents can add new Intents and chatbot responses, and add new training phrases to existing intents on the fly from the admin area by moving the mouse cursor over a message and clicking the Dialogflow Intent icon. New Intents will contain also the responses, while the update of existing intents will add new training phrases only, but not new chatbot responses. If you’re using Dialogflow CX, the chatbot responses will be added to the latest flow used in the conversation if any, otherwise to the start flow.

Departments linking

Get the department IDs from Settings > Miscellaneous > departments.

Get the project IDs from the Dialogflow settings area of your agents.

More information

You can activate the chatbot via API but sending a message with no text and payload { "event": "activate-bot" }.

Supported chinese language is only Chinese – Simplified. Please use the Dialogflow language Chinese – Simplified (zh-CN) only. The languages codes zh-HK and zh-TW will not work.

The following details are sent to Dialogflow in the queryParams parameter when detecting an intent: conversation_id, user_id.

To trigger the welcome event in Dialogflow CX, create a Event Handler and insert Welcome as Custom Event.

EBOT365 articles are synchronised automatically with the Dialogflow knowledge base.

Use the JS variable SB_DIALOGFLOW_AGENT = "AGENT ID" to change the default Dialogflow agent, replace “AGENT ID" with the project ID.