Google
The settings below are related to the Artificial Intelligence app.
Synchronization
To start using the Google AI services and Dialogflow follow the steps below.
Automatic sync mode
Click
Synchronize nowand complete the procedure.If you want to activate the Dialogflow chatbot, check
Settings > Artificial Intelligence > Google > Dialogflow chatbot. Also, you have to enter your chatbot Project ID or Agent Name, to get it follow the steps below.You need to purchase credits to use this option.
Manual sync mode
Enable the setting
Chat Board > Settings > Artificial Intelligence > Google > Dialogflow Chatbotand save the changes.Go to console.cloud.google.com and sign in.
Select or create a project by clicking the
Select a projectbutton on the top-left. Name the project as you want.Activate the Dialogflow API by entering
Dialogflow APIon the top search bar. ClickDialogflow APIand then clickEnable.Select the project and the go to
Left menu > APIs and services > OAuth consent screen. SelectExternaland clickCreate. In theApp nameenter what you want, in theUser support emailandDeveloper contact informationenter your email. ClickSave and continue.In the scopes area, click
Add or remove scopes, scroll bottom, and into theManually add scopesarea enterhttps://www.googleapis.com/auth/dialogflow,https://www.googleapis.com/auth/cloud-language,https://www.googleapis.com/auth/cloud-translation. ClickAdd to tableand thenUpdateandSave and continue.In the test users area, click
Add Usersand add your Google email, use the same email as the currently logged-in account. ClickSave and continue.Go to the
Left menu > APIs and services > Credentialsand clickCreate credentials, selectOAuth client ID. AsApplication typeselectWeb application. Enter any name you want. InAuthorised redirect URIenter the redirect URL, get it fromChat Board > Settings > Artificial Intelligence > Google > Authorised redirect URI. ClickCreate.Copy
Client IDandClient Secretand paste them intoChat Board > Settings > Artificial Intelligence > Dialogflow. Save the settings.In
Settings > APIs & Services > OAuth Consent ScreenclickPUBLISH APP. There is no need to complete the review process, leave it in the pending review state.Click
Chat Board > Settings > Artificial Intelligence > Google > Synchronize. Login with the same Google account you have used till now. On the next screen clickContinue. On the next screen select all scopes and clickContinue.Copy the
Refresh tokenand paste it intoChat Board > Settings > Artificial Intelligence > Google > Refresh token.You are done! If you want to activate the Dialogflow chatbot, check
Settings > Artificial Intelligence > Google > Dialogflow chatbot. Also, you have to enter your chatbot Project ID or Agent Name, to get it follow the steps below. Note that the app does not need to be approved by Google.If you are a Google Workspace user, go to https://admin.google.com/ and click
Google Cloud Session control. Set theRe-authentication policytoNever require re-authentication.
Dialogflow
The information provided below is relevant to Dialogflow.
Get Project ID
Log in to the Dialogflow ES console by going to dialogflow.cloud.google.com. You must sign in with the same Google account used during the synchronization.
Click the
gear iconat the top left, near the chatbot name, and open the settings area. . If you haven't created a chatbot yet, follow the instructions below to create your first bot.Copy the
Project ID.Make sure to choose
US / GLOBALon the top left of the Dialogflow dashboard. Please note that our system does not support mega agents. .
Get Dialogflow CX Agent Name
Log in to the Dialogflow CX console by going to https://dialogflow.cloud.google.com/cx/.
Select the project of the desired agent and go to the agent's page. You can enter the agents page by selecting the agent and by clicking the top button
Agents > View all agents.Click the options menu for the desiderate agent in click
Copy name.
Location
Set the location or region of your Dialogflow agent. This setting is optional if your agent location is set to global.
Welcome Intent
Trigger the Dialogflow Welcome Intent for new visitors. The option Settings > Messages > Welcome message must be active.
Send the user details
Send the user details of the registration form and email rich messages to Dialogflow.
Add Intents to saved replies
Include the Dialogflow Intents in the saved replies. To access the saved replies option, go to Settings > Admin > Saved replies.
Create a basic chatbot
If you haven't created a chatbot yet, follow the instructions below to create your first one. The creation and management of your Dialogflow chatbot is handled entirely by Dialogflow. There are a lot of tutorials online that can help you create and configure your Dialogflow bot.
To create your first chatbot enter the Dialogflow console and create an agent. As Google Project selects the same project used during the synchronization.
Add a new
Intentfrom the left menu and open it.In the
Training phrasesarea add the user's question you want the chatbot to reply to, and add as many variants are you can. For example, if you want the chatbot to reply to users asking for your business address, add variants like "What is your address", "address", and "Where are you".In the
Responsesarea add the chatbot answer as atext response. If you want to add buttons, cards, etc., you can use the rich messages.You have created your first question and answer! Test if from the right area or the Chat Board chat. Add new Intents to populate your chatbot with the questions and answers you want. You can include basic pre-built questions and answers by enabling the
Small Talkfeature from the left menu.
Resources
Here are some great resources to help you build a more complex chatbot
Actions
The following actions give the chatbot the ability to interact with the website autonomously on behalf of the user. To use an action go to Dialogflow, edit an Intent, and add a new Custom Payload response with the following syntax: { "ACTION-NAME": ACTION-VALUE }.
{ "human-takeover": true }Disable the chatbot for 5 minutes, notify agents, and leave the conversation marked as unread.
{ "disable-bot": true }Disable the chatbot for 5 minutes.
{ "redirect": "URL" }Redirect the user to the given URL. Add the value "new-window": true to open the URL in a new window.
{ "open-article": ID }Open the article with the given ID.
{ "transcript": true }Generate the conversation transcript as a text file and download it. Set it to email to send the transcript to the user's email, and add the value message: "Your message" to include a message in the email.
{ "tags": ["Tag 1", "Tag 2"] }Assign tags to a conversation.
{ "department": ID }Change or set the conversation department and notify the agents.
{ "agent": ID }Change or set the agent assigned to the conversation and notify the agent.
{ "send-email": { "recipient": "active_user", "message": "", "attachments": [] } }Send an email to the active user or agents. Attachments syntax: [["name", "link"], ["name", "link"],...]}. The recipient value can be active_user or agents.
{ "update-user": true }Tells the admin area to update the user of the active conversation. Use this action in combination with other actions to update the user details of the admin area in real-time.
{ "archive-chat": true }Archive the chat and send the close message if active.
{ "update-user-details": { "email": "", "last_name": "", "first_name": "", "extra": { "phone": ["+123456789", "Phone"] }}}Update the details of the active user. You can update all details, including first_name, last_name, email, user_type, password You can update the user's extra details, like the phone number, by entering the values into the extra key, the values must use the following syntax: "slug": [value, "label"]. Download an example here. To upload an Intent go to the Intents area and click the 3-dots menu icon on the top-right, then click Upload Intent. Start the conversation by sending the message "start".
{ "update-user-language": "$language" }Update the user language, and the chatbot language if the multilingual chatbots feature is active, to match the language requested by the user. The Dialogflow Entity value for the language is represented by the parameter $language.
Dialogflow Fulfillment
The fulfillment data sent to your webhook URL is like below:
{
"responseId": "4a58fc4f...",
"queryResult": {
"queryText": "fullfilment",
"parameters": [],
"allRequiredParamsPresent": true,
"fulfillmentText": "Example",
"fulfillmentMessages": [{
"text": {
"text": ["Response"]
}
}],
"outputContexts": [{
"name": "projects/schiocco...",
"parameters": {
"no-input": 0,
"no-match": 0
}
}],
"intent": {
"name": "projects/schiocco...",
"displayName": "Fullfilment"
},
"intentDetectionConfidence": 1,
"languageCode": "en"
},
"originalDetectIntentRequest": {
"payload": {
"chat_board": {
"conversation_id": "3002",
"user_id": "3777"
}
}
},
"session": "projects/example/agent/sessions/3777-3002"
}The payload and session fields contain the Chat Board user ID and conversation ID.
Dialogflow Information
Chatbot training and optimization
It will require some time for your chatbot to consistently provide correct answers to all questions. To improve its performance, you and your human agents should continuously train the chatbot by incorporating new question variations and Intents. This approach will effectively enhance the capabilities of your chatbot.
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. Enable
Settings > Artificial Intelligence > OpenAI > Generate user expressionsto automatically add variations of the question and to rewrite the answer. 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.If the chatbot is replying with the wrong intents, go to
Dialogflow Console > chatbot Settings > ML Settings, and set theML CLASSIFICATION THRESHOLDto a larger number, such as0.6. Also check the Intent detection confidence.
Dialogflow Intent detection confidence
When searching for a matching intent, Dialogflow scores potential matches with an intent detection confidence, also known as the confidence score. These values range from 0.0 (completely uncertain) to 1.0 (completely certain). Specify a value ranging from 0.1 to 1.0. Any answer provided by Dialogflow that is less than this value will not be considered. If you are utilizing Dialogflow alongside your OpenAI chatbot that is trained using your resources, it is recommended to configure the value as 0.81.
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.
Ignore an Intent if it doesn't fit the provided keywords
Sometimes Dialogflow gives incorrect answers due to similar questions with different subjects. To solve this, you can instruct Chat Board to ignore an Intent if specific keywords are not present in the user's message. Here's how you can do it:
Enter Dialogflow and edit the Intent.
For each training phrase, select the keywords you want to be required and link them to a new Entity, or an existing one.
Under Actions and parameters check Required and add a new Prompt with value skip-intent
Save the Intent.
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://eduhub.solutions/archive.zip,extension:zip]
[name:license.pdf,url:https://eduhub.solutions/license.pdf,extension:pdf]Chatbot 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 exact 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 rich message section.
Rich message response
When the user interacts with rich messages via the Chat Board 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.
Suppose the user is interacting with the chatbot via a messaging app (e.g. WhatsApp). In that case, 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 responses for registration, email, and follow-up
Check the option
Chat Board > Settings > Artificial Intelligence > Google > Send user details.From the
Left menu > FulfillmentenableWebhooks, 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 entersb-follow-up-form, for email forms enteremail.Enable the Fulfillment of the Intent.
You're done! The file of the webhook URL will receive the Chat Board rich message user details.
Sequential survey
To create a sequential survey like the one in 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 phrasesarea enter the user expressionsurvey example. In theResponsesarea 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-1and 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-2and as a response enterThank you for completing our survey!.You're done.
Department linking
Get the department IDs from
Settings > Miscellaneous > departments.Get the project IDs from the Dialogflow settings area of your agents.
More information
Dialogflow supports the use of voice messages through speech recognition. WhatsApp audio messages and .ogg audio files are not natively supported. To support WhatsApp audio messages and .ogg audio files, activate
Settings > Artificial Intelligence > OpenAI > Speech recognition.You can activate the chatbot via API by sending a message with no text and payload
{ "event": "activate-bot" }.The following details are sent to Dialogflow in the
queryParamsparameter when detecting an intent:conversation_id,user_id.To trigger the welcome event in Dialogflow CX, create an
Event Handlerand insert Welcome as aCustom Event.Chat Board articles are synchronized automatically with the Dialogflow knowledge base.
Use the JS variable
SB_DIALOGFLOW_AGENT = "AGENT ID"to change the default Dialogflow agent, and replace "AGENT ID" with theproject ID.If the user sends the same message again, triggering the same Intent in Dialogflow, and OpenAI is active, the Chat Board will attempt to send a message from OpenAI and will ignore the response from Dialogflow.
You can access the
user_idandconversation_idof the current user and conversation in Dialogflow CX using the$session.params.user_idand$session.params.conversation_id codes, which are located in the Condition area of the route.
Multilingual Chatbot
The feature Artificial Intelligence > Google > Multilingual checks if there is a Dialogflow agent in the user's language and activate it.
For this feature to work the user language must be known. The user language is based on the language user detail of the user if set, otherwise on the user browser language. The language can also be detected with the language detection feature.
Make sure to activate this setting even if your OpenAI sources consist of multiple languages.
Automatic Translation
The automatic translation feature automatically translates user messages into agent language and agent messages into user language. To enable it check the option Settings > Artificial Intelligence > Automatic translation and complete the synchronization process. The multilingual via translation feature also requires these steps.
The Google account used for the Dialogflow synchronization must have billing and the
cloud-translationservice enabled, to do that follow the steps below:Log in to https://console.cloud.google.com with your Google account and select the project of your Dialogflow Agent.
On the top search bar type
cloud translation, select theCloud Translation APIservice, and enable it. Please note that this is a paid service with a free tier, additional charges may occur.Enable the billing by clicking the
Left menu > Billingand by enabling a billing account with a valid payment method. Enable billing for the project of your Dialogflow agent.
Information
The user messages in the admin area are translated automatically in real time to match the agent language.
The agent messages are translated automatically in real time to match the user language.
Agents can view the original message by opening the message menu and by clicking
View original message.The agent language is based on the
languageuser detail of the agent if set, otherwise on the browser language, or admin area language.The user language is based on the
languageuser detail, if set, otherwise on chat language, if set, otherwise on the browser language. The language can also be detected with the language detection feature.The notifications are also translated.
To avoid translating a string, enclose it with the characters
`or```.
Multilingual via translation
The feature at Settings > Artificial Intelligence > Multilingual via translation automatically translates user messages into the default language of Dialogflow or OpenAI and translates Dialogflow or OpenAI messages into the language spoken by the user. Additionally, this feature translates all text displayed within the chat, such as the chatbot's rich messages, registration forms, and pop-up notifications. To enhance performance and minimize translation costs, the translations are automatically integrated into the translation files. Combine this feature with the language detection feature for optimal results.
The original texts must be in English.
Language detection
Detect the language of the user's messages and change the user language and Dialogflow agent language accordingly, if available, otherwise, show a fallback message. You can use the following merge fields in the message: {language_name}.
The user message must be at least 2 words long.
Language detection is executed only for the first 2 user messages of a conversation.
As long as the OpenAI chatbot is operational and programmed to respond to generic inquiries, the fallback message will never be dispatched, since OpenAI will consistently provide answers to any use message.
Google search
The Google search features give your chatbot the ability to search for answers on Google and your website and automatically correct misspelled user questions. To start using it, follow the steps below.
Register at https://programmablesearchengine.google.com/.
Create a search and set it as you want. We recommend adding only your website and Wikipedia if you want your chatbot to reply to general questions, leave disabled the option to
Search the entire web. Use the settingEntitiesto exclude invalid results.Go to
Edit search engine > Setup > Basicand copy theSearch engine IDvalue, paste it in Chat Board.To get the API key visit https://developers.google.com/custom-search/v1/overview and click
Get a key.
Spelling correction
In the case where Dialogflow is unable to find the appropriate response to the user's message, this function verifies if there are any spelling errors. If any such errors exist, Dialogflow is prompted again with the correctly spelled version of the message for an accurate response. Although it has a lower priority, this feature can still work together with the OpenAI Dialogflow spelling correction feature.
Entities
The Entities setting analyzes the user's message and recognizes and extracts entities like cities, events, dates, and more. Use it to exclude invalid results returned by Google search. To enable this setting follow the steps below.
Log in to https://console.cloud.google.com with your Google account and select the project of your Dialogflow Agent.
Enter
Cloud Natural Language APIin the search bar at the top, selectCloud Natural Language API, and enable the API.Enable the billing by clicking the
Left menu > Billingand by enabling a billing account with a valid payment method. Enable billing for the project of your Dialogflow agent.
Information
The Google search is performed only if the chatbot does not know the answer to the user's question and if the length of the user's message is greater than 4 characters.
If the Google search returns a result, the Dialogflow context
google-searchis automatically activated. The context contains the attributelinkwhich is the website's link of the Google search result. Use the context to create a new intent that provides the link, if the user sends a message liketell me moreorI want to know more.Google Search is not required to activate the spelling correction. You can disable Google Search and activate only spelling correction.
If Google Search is active, it will have priority over OpenAI.
Last updated