Skip to main content

Dialogflow ES

In this tutorial, you will learn how to integrate your instance of Dialogflow ES, so that you can send the audio from the call to it and get the response from your bot plated on the call.

Getting started

In order to do successfully integrate Dialogflow ES with Telnyx Voice API, you'll need to start by assigning the Dialogflow configuration to your Voice API application using the following update request.

curl -X POST \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer YOUR_API_KEY" \
--data '{ \
}' \{connection_id}

Note that GOOGLE_APPLICATION_CREDENTIALS must be provided in a form of encoded json. Google Dialogflow Setup.

When the configuration is assigned to the application users can enable the Dialogflow integration for every outbound or inbound call.

Enabling dialogflow for outbound calls

curl --location --request POST '' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"enable_dialogflow": true

Enabling dialogflow for inbound calls

curl -X POST \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer YOUR_API_KEY" \
--data '{"enable_dialogflow": true}' \{call_control_id}/actions/answer

When the integration is enabled, users can expect the audio provided by Dialogflow will be played on the call, and the following webhooks will be delivered to the webhook url:

"data": {
"event_type": "dialogflow.detectintent.response",
"id": "22cbf929-9a87-43ab-873b-b832ccf05a05",
"occurred_at": "2022-05-23T16:01:53.301413Z",
"payload": {
"call_control_id": "v2:WE_lbN28P-h81n4xeceODATcx9J-FYci6WO4hP3Gp9Sb789WivnkMw",
"call_leg_id": "a3dc0316-dab1-11ec-aaff-02420a0d6669",
"call_session_id": "a3cf4428-dab1-11ec-84a9-02420a0d6669",
"client_state": null,
"confidence": 1,
"connection_id": "1669581837548127492",
"fulfillment_messages": [{
"text": [
"Hi! I'm the virtual car rental agent. I can help you start a new car rental reservation. How can I assist you today?"
"is_final": true,
"stream_id": "eb724ae3-4f93-49d0-9ab5-c821b47c4fc5",
"transcript": "hello"
"record_type": "event"
"meta": {
"attempt": 1,
"delivered_to": ""

Need some assistance?

If you need some help, reach out to a member of our team through our form or the portal.

On this page