Pleased to announce that we have successfully tested and deployed Google dialogflow with ICTBroadcast.

Google Dialogflow is a natural language understanding platform that makes it easy to design and integrate a conversational user interface into smart application, bot, interactive voice response system, and so on. Using Dialogflow, we can provide new and engaging ways for users to interact with your product.

Google DialogFlow integration enable ICTBroadcast users to launch smart campaigns, which can automatically interact with prospects/clients using the power of artificial intelligence. ICTBroadcast can use ASR and smart chat services from Google dialogflow to accomplish this.

The following is the list of significant benefit of this integration.

* Natural Language Processing
* Automatic Speech Recognition
* Text to Speech
* Triggerable actions for 3rd party API integration

DialogFlow Integration
————————-

Create DialogFlow ES Project

DialogFlow Essentials project is required for this integration, Projects allow to manage all Google Cloud Platform resources, including deployment, access control, billing, and services.

Project can be created as mentioned int the following.

* Create a project in the Google Cloud Platform Console, if not already created.
* Enable billing for the newly created account

 Create DialogFlow Agents

A Dialogflow agent is a virtual agent that handles concurrent conversations with your end-users. It is a natural language understanding module that understands the nuances of human language. A Dialogflow agent is similar to a human AI powered call center agent. You train them both to handle expected conversation scenarios, and your training does not need to be overly explicit. Basically DialogFlow agents allow users to configure DialogFlow as per the required localization and other settings.

After create an agent in DialogFlow remember to change the following configuration.

* Visit https://dialogflow.cloud.google.com/
* Click on Create new agent
* Fill the name and other details and save the agents
* After create new agent, select it, and click the **Gear** or setting icon against its name
* In configuration screen select the **Speech** tab
* Then enable **Enable Text to Speech** option under TEXT TO SPEECH section, as seen in the pic

![Agent settings, Enable Speech Output](agent_speech.png)

 Get Google Cloud Credentials

Google Cloud keys are required for ICTBroadcast integration with DialogFlow. Following are steps to download the service account credentials file:

* In the Google Cloud Platform Console, navigate to API & Services > Credentials > Create credentials > Service account key
* Under Service account, select New service account.
* Under Service account name, enter a service account name of your choice. For example, accessor.
* Under Role, select Project > Owner.
* Under Key type, leave JSON selected.
* Click Create to create a new service account and download the json credentials file.

![Google Cloud Key Setup](google_key.png)

 Configure Keys in ICTBroadcast

Login into ICTBroadcast GUI as admin, and then

* Open **System Configuration** under **Administration** menu
* Click on **Google Cloud** tab
* Open the downloaded credentials file (as mentioned in A.2) and copy its contents
* Paste the content into **Google Cloud Key** field
* Save the configurations

Training the Chat Bot using DialogFlow Intents
————————————————-

Following are details of **DialogFlow Intent** components as per the ICTBroadcast AI powered auto dialer perspective, or more precisely how one can relate it with classical Interactive Voice Response (IVR) System, These instruction should be observed while training DialogFlow Agent / Creating intents for ICTBroadcast

For complete instructions please consult the official documentations of DialogFlow Essentials to have an idea how to setup / train a bot for the desired service /campaign. https://cloud.google.com/dialogflow/es/docs

 Intents

Intent mean an option or choice which user can select, just like an IVR menu which can have multiple options. we need multiple intents to create something similar to classical IVR menu.

* A single intent is equivalent to single option in IVR menu
* Multiple intents should be grouped together using a context (see Contexts) to achieve a scenario similar to IVR menu.
* Fallback intents can be used to create a default option in a particular context

 Contexts

There are two context fields available in each intent, as mentioned in the following.

Input Context

It is required to link the intent to a predecessor intents, i.e after executing an intent with a particular output context, all intents having matching input context, will be activated and user response will be analyzed according to those intents only. Just like classical IVR menu where user is restricted to choose only from the available menu options.

 Output Context

After matching/executing an Intent, DialogFlow read its output context and activate all matching intents (having same input context) for next recognition.

 Training Phrases

Unlike a fixed DTMF digit for each IVR option, Each intent should list various phrases which can be used by a natural language speaker to select the particular intent.

 Response

This message will be played to end-user, upone matching the intent, Just like IVR system play the next menu / recording when user select a particular IVR option.

Response message can be customized by using the following tokens / variables related current Caller / End-User (will be set / provided by ICTBroadcast)

* $contact_first_name
* $contact_last_name
* $contact_phone
* $contact_email
* $contact_address
* $contact_custom1
* $contact_custom2
* $contact_custom3

 Events

The welcome intent, or the very starting intent must be tagged with **main** keyword as event

 Parameters

Training phrases can also be used to collected parameters (see official documentation), Later these parameters can be used with responses or by ICTBroadcast AI powered auto dialer (see the Action and Integration sections)

Note: In case user wants to reuse the parameters which was collected from some predecessor intent, then said parameters should be mentioned again in current intent. see the following screenshots.

![Parameter in Predecessor Intent](parameter_1st.png)

![Reusing parameter in successor Intent](parameter_2nd.png)

Actions

Actions can be used to trigger **Integrations** in ICTBroadcast. Using the mapping between DialogFlow actions and ICTBroadcast AI powered auto dialer Integrations (See Campaign sections) user can configure a campaign to trigger desired Integration in ICTBroadcast. Parameters collected in DialogFlow / Intents will be used with Integration.

**Note:** Parameter collected in proper token format (as mentioned in response section) will update ICTBroadcast local contact database automatically
**Note:** Action is just a name, which will be used to trigger ICTBroadcast. so please make sure that it should be exactly same as in ICTBroadcast. i.e smaller case, no space or other special characters etc …

Note: there is a special action to the end call, please use `call.hangup` as action in intent where you want to end the call, for example it can be used in `Good Bye` intent

Preparing DialogFlow for Smart Campaigns
——————————————-

 DialogFlow Campaign

Visit ICTBroadcast portal and fill the form as shown in the attached screenshot

![DialogFlow Campaign Settings](dialogflow_campaign.png)

Integration mapping with DialogFlow

As mentioned above ICTBroadcast can trigger Integration when it receive an action request from DialogFlow. it can be accomplished by completing the following two steps.

* Create integration using the ICTBroadcast GUI for integrations
* While create/launching new campaign Map DialogFlow **Actions** with ICTBroadcast **Integration**, as show in the following screenshot

![Action and ICTBroadcast Integration](dialogflow_action.png)

Use Cases and Scenarios
————————–

Account Information by Phone

An Ent-User calls the provided support system. system recognize / load its accounts number using his/her CLI. and will play his current dues with the system.

This scenario can be accomplished by

1. Create / Prepare a contact group in ICTBroadcast, and make sure custom1 filed have the due amount
2. Create a Welcome intent (i.e with “main” event) and enter something similar to the following in its response
Hi $contact_first_name $contact_last_name, There are $contact_custom1 usd due against you. Thanks
3. Create and launch the DialogFlow campaign in inbound mode, using the DialogFlow project and contact group as mentioned above

 Appointment By Phone

An Ent-User calls the provided number for the appointment. select a date and time. his/her information will be updated into ICTBroadcast contact group, which can be used/manually processed by someone

1. Create an contact group in ICTBroadcast AI powered auto dialer
2. Design / Train the DialogFlow to collect the appointment date and time into $contact_custom1 and $contact_custom2 respectively
3. Make sure that both variables are available in the selected intent, then set its action to `input.appointment`
4. Create and launch the DialogFlow campaign using the DialogFlow project and contact group as mentioned above

 D.3 Order by Phone (E-Commerce/CRM Integration)

An Ent-User calls the provided number to order. He/She select a product, tells its quantity and other required specifications and confirm their order. ICTBroadcast will push every received order to 3rd-party E-Commerce / CRM via REST APIs and Integration setup.

1. Create an empty contact group in ICTBroadcast AI powered auto dialer
2. Using the order APIs from the CRM or E-Commerce portal, create an Integration in ICTBroadcast
3. Design / Train the DialogFlow to collect the order details like product name, quantity and size etc …
4. Make sure that all variables are available in the selected intent, then set its action to `input.order`
4. Create and launch the DialogFlow campaign using the DialogFlow project and contact group further please remember to map the above created Integration with `input.order` action.