Chat activities and events In Dialogflow, you can add a number of activities to your agent’s conversation. These include postbacks, which send information to the developer of the agent, as well as custom text and speech interactions. You can also add events that trigger other actions within the Dialogflow platform. For example, you could have an event that calls a webhook when the user says “call me at home” and then use the webhook to call your phone. Getting started with chat activities To get started with chat activities in Dialogflow:

Step 1: Create or select an agent project. Steps for this are shown in Part 3 above.

Step 2: Add a new activity in your agent project: Go to https://dialogflow.com/agents/[agent-name]/activities Click the plus sign button on the left side of the page In the Add new Activity dialog box, type a name for your activity (for example, “say_hello”) Select a page template from the list The Page Template dropdown contains all available templates for building conversation flows and is shown below Click Create Activity Click Test on Webhook to test your new activity If it doesn’t work as expected, double check that you have followed these steps exactly and that there are no error messages (see troubleshooting below)

Step 3: Use an activity in your agents conversation flow by placing it on a step in one or more pages Your page can contain any number of steps including custom logic such as built-in functions and entities Look up how to do this here — see Part 3 above

Step 4: Save When you save changes made to conversations using Dialogflow Designer or API requests , those changes are reflected immediately in all agents activated after those changes (i.e., if you save a change at 10am PT and activate multiple agents after that time). To force immediate activation of all agents regardless of when they were last activated, click Activate All Agents on Agent Settings . Note : Changes made using Console will be reflected immediately only if both agents belong to different accounts; otherwise you must click Activate All Agents .

For more details about activating agents please see here . Using conversational elements from other services with Chat Activities You can use chats activities together with other services like Facebook Messenger using their respective bot frameworks , but ensure you follow all requirements given by each service for using their bots so that Google does not take any action against your account violating its Terms Of Service (TOS) . As an example , if there is one requirement provided by Facebook for creating bots via its bot framework , then make sure that each requirement is met before enabling them inside Google’s Chat app / DialogFlow service .

This applies even if Google allows users on behalf of another provider .. Here is an overview of some examples where we provide support for third party services : User behavior tracking through Firebase / Crashlytics / Fabric (Google Play Services ) User behavior tracking through Slack Integration Support for Oauth 2 authorization code flow into DialogFlow Support for OAuth 2 access token refresh flow into DialogFlow etc … For more information , visit our documentation site at https://docs.google.com/document/d/1EL0U6qcjKxBQYpwL4lTgmf7zdRtbVg8ByyN9EoOikMg/edit?usp=sharing – Google Help Center Team Troubleshooting Chat Activities Chat activities run in the browser on the user’s device. If you have enabled the Logging for this activity option, then you can see logs for your activity in the Logs section of your Dialogflow console .

To view these logs: Go to https://console.developers.google.com/project Select an agent Click Logs on the left side of the page In the text box next to “Log Level,” type a string that appears in your activity log results, such as “say_hello” or “call me” Click Search . This will allow you to see if there are any logs for that string you typed (if it does not appear at all, then your logs have not been activated yet) . To view logs for individual agents, click an agent name in the list on the left side of the page To view logs for multiple agents, select multiple names by holding down SHIFT and clicking on each name in turn To specify more search criteria (for example, filter out a log level), click Show More Options in the results list and use additional fields as needed Chatbot events You can also trigger events within Dialogflow that will cause other actions to occur within your Dialogflow account.

As an example, you could create an event called “ReceiveOrder” with three parameters: orderID , product , and quantity . When this event occurs, you could add a new fulfillment intent that ships products from one of your warehouses based on orderID and quantity . For details about using events to trigger actions within Dialogflow:

Step 1: Create or select an agent project. Steps for this are shown in Part 3 above.

Step 2: Add a new event in your agent project Go to https://dialogflow.com/agents/[agent-name]/events Click Add Event In the Add new Event dialog box : Type a name for your event (for example, “ReceiveOrder”) Type parameter names and values into available fields as needed If you want users of your agent to be able to customize these values when they call an intent with those values, uncheck Default value (optional) Click Create Event

Step 3: Use an activity or webhook Callback URL field when creating it Make sure you follow instructions provided by Google when adding data sources like Google Calendar or Drive in Dialogflow’s console See here : Getting Started with Events & Data Sources Support When creating data sources supported by Dialogflow , make sure you place them under [Your Project Name] > Settings > Data Sources > [Data Source Name] Here’s how support webhooks work with DialogFlow : Users can run through their question-answer session normally without needing any knowledge about webhooks .. Once they reach completion of their session , if they ask something like “Send me a reminder next Tuesday” then our service will automatically send them a POST request via this URL – https://webhook-url/session-id – where sessionId is equal to their current session ID generated by our system after they completed their session . The POST request contains following information : { “payload” : { “order_ids” : [], // List of order IDs which user has ordered } } Based on this information , we can pick up required orders & create fulfillment intents accordingly . Please note that users can set custom attributes here which needs to be added inside payload section along with order_id attribute .. There is no limit on how many times we can send out requests depending upon application requirements . We recommend sending response after a delay of 20minutes so that we don’t overload our servers too much .. You can also setup multiple URLs pointing at different endpoints just like below – http://mywebservice1.com/?appKey1=value1&appKey2=value2&…&appKeyN=valuen where appKeyX is equal to some unique key associated with specific backend endpoint which accepts these POST requests coming from Google’s server .. It will again return same JSON object as explained above but instead of Order IDs it would contain some other information based upon backend logic defined at mywebservice1..com endpoints above .. This approach would help you scale up / scale down only parts of business logic while leaving rest parts untouched … For more details please visit here – https://cloud.google.com/intents/webhooks/docs#create_a_new_webhook

Note : We highly recommend using Firebase Hosting as it offers good performance & scalability at low cost compared to self hosted services used earlier Now whenever users ask us questions like “What is my balance ?” it helps us pick up corresponding conversation & process it accordingly using corresponding backend API which generates appropriate responses back into Google’s system or directly back into users’ devices depending upon requirements Using your own webhooks for custom logic Most of the time, you don’t need to create your own webhook at all. However, some companies may find it useful to use their own webhooks in addition to the Google-hosted webhooks that Dialogflow uses by default. If this is the case, read on! Note: You must be careful when using your own webhooks with Dialogflow.

This involves a lot of work that is best suited for developers who have experience with server-side development. It’s also worth noting that while adding a custom URL as an event Callback URL will allow you to trigger an intent from Dialogflow, it won’t allow you to invoke Dialogflow from your application instead. For more details about using events to trigger actions within Dialogflow:

Step 1: Create or select an agent project Steps for this are shown in Part 3 above .

Step 2: Add a new event in your agent project Go to https://dialogflow.com/agents/[agent-name]/events Click Add Event In the Add new Event dialog box : Type a name for your event (for example, “ReceiveOrder”) Type parameter names and values into available fields as needed If you want users of your agent to be able to customize these values when they call an intent with those values, uncheck Default value (optional) Click Create Event Click Save

Step 3: Set up your custom endpoint For now we’ll assume you’re building an application on top of NodeJS .. So go ahead and create a Node

If you’d like to learn more about Dialogflow please leave a comment below and one of our team members will reach out to you.


Marco Lopes

Excessive Crafter of Things

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *