We will learn how Dialogflow connects with backend systems to provide rich and dynamic responses to users questions. We will use the same Agent that we created in previous labs “Appointment Scheduler”. In the Agent’s GCP project we will enable Google Calendar API and a service account to access google calendar. Then we create the fulfillment and use the credentials we generated for the calendar access to connect it with the fulfillment. Finally we will test to see if the calendar invites are being set up per user request.

What is Fulfillment?

Fulfillment is code that’s deployed as a webhook that lets your Dialogflow agent call business logic on an intent-by-intent basis. During a conversation, fulfillment allows you to use the information extracted by Dialogflow’s natural language processing to generate dynamic responses or trigger actions on your back-end.

Most Dialogflow agents make use of fulfillment. The following are some example cases where you can use fulfillment to extend an agent:

Enable Calendar API

 

Setup Service Account

 

 

Calendar Setup

 

 

 

 

Setup Fulfillment in Dialoflow

Add Service Account and Calendar ID to Fulfillment

 

https://gist.github.com/arifmarias/8e2cb0ab322d491e0379d0e067f581d6

https://gist.github.com/arifmarias/210f09bab74565968bd33439389b5187

const timeZone = ‘America/Chicago’;

const timeZoneOffset = ‘-05:00’;

Enable Fulfillment response

 

Test Your Chatbot!

Let’s test our chatbot, you can test it in the simulator or use the web or google home integration we have learnt in previous codelabs.

 
 

Congratulations!

You created a fulfillment using inline editor and integrated with Google Calendar. Think of more such integrations like these.