Creating a virtual agent with Twilio and Google Dialogflow

I have taken my work with Twilio Programmable Voice and SMS to the point where I have something to show for all my effort. The best way to experience my virtual agent is to call 207-825-2956 from a mobile phone. You can do this from a landline, too, with one exception that I explain below. Once the call answers, you can ask the VA a variety of questions. They include:

Tell me a joke. Tell me a Chuck Norris joke. What is the unemployment rate? What is the prime rate?

These functions are answered by various cloud services my VA interrogates with. For instance, the financial questions are answered by a connection to live Federal Reserve data.  The Chuck Norris questions are answered by the on-line Chuck Norris joke service.

Since this is my VA and you all know how much I love bread, I included a reference to the Bob’s Red Mill sourdough FAQ (https://www.bobsredmill.com/learning-center/sourdough/faq). You can ask the VA any question found in the FAQ. It’s important to know that I did not have to code all the questions and answers into my VA. The VA dynamically retrieves them via a Dialogflow knowledgebase. Example questions include:

How do I know if my sourdough starter has gone bad? How do I maintain sourdough starter in the refrigerator? How do I make my sourdough more sour?

If you called from a text-capable mobile phone, you can say, “Transfer me to text.” The VA will then move the conversation from voice to text. Very cool.

Note:  After seeing so many people attempt to transfer to text on a non text-capable device, I added code to detect if the caller was on a mobile phone before attempting the transfer.  I do that using an Avaya CPaaS carrier API.  That’s the power of cloud services.  I can mix and match as needed.

Lastly, you can say “Goodbye” on the voice call to release the call.

What you can’t see (or hear) from the demo is how I have taken advantage of all sorts of Twilio and Dialogflow functionality. For instance, I coded for silence detection and keep the call alive even if nothing is spoken.  That was actually a bit of a trick.  Also, I am combining two Twilio services (voice and text) into one VA.  To me, that is one of the coolest aspects of my software.

Let me know what you think!

2 comments

  1. Nicely Done! I have enjoyed the Twilio tutorials. The Studio is a fun tool. Did you use Studio to build this?

    1. Thanks. I used the Twilio APIs. My application runs on a Linux server and is invoked by Twilio via various webhooks. It sits between Twilio and Dialogflow.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: