Skip to main content
POST
/
dialogflow_connections
/
{connection_id}
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const dialogflowConnection = await client.dialogflowConnections.create('connection_id', {
  service_account: {
    type: 'bar',
    project_id: 'bar',
    private_key_id: 'bar',
    private_key: 'bar',
    client_email: 'bar',
    client_id: 'bar',
    auth_uri: 'bar',
    token_uri: 'bar',
    auth_provider_x509_cert_url: 'bar',
    client_x509_cert_url: 'bar',
  },
});

console.log(dialogflowConnection.data);
import os
from telnyx import Telnyx

client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
dialogflow_connection = client.dialogflow_connections.create(
connection_id="connection_id",
service_account={
"type": "bar",
"project_id": "bar",
"private_key_id": "bar",
"private_key": "bar",
"client_email": "bar",
"client_id": "bar",
"auth_uri": "bar",
"token_uri": "bar",
"auth_provider_x509_cert_url": "bar",
"client_x509_cert_url": "bar",
},
)
print(dialogflow_connection.data)
package main

import (
"context"
"fmt"

"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)

func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
dialogflowConnection, err := client.DialogflowConnections.New(
context.TODO(),
"connection_id",
telnyx.DialogflowConnectionNewParams{
ServiceAccount: map[string]any{
"type": "bar",
"project_id": "bar",
"private_key_id": "bar",
"private_key": "bar",
"client_email": "bar",
"client_id": "bar",
"auth_uri": "bar",
"token_uri": "bar",
"auth_provider_x509_cert_url": "bar",
"client_x509_cert_url": "bar",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", dialogflowConnection.Data)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.core.JsonValue;
import com.telnyx.sdk.models.dialogflowconnections.DialogflowConnectionCreateParams;
import com.telnyx.sdk.models.dialogflowconnections.DialogflowConnectionCreateResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();

DialogflowConnectionCreateParams params = DialogflowConnectionCreateParams.builder()
.connectionId("connection_id")
.serviceAccount(DialogflowConnectionCreateParams.ServiceAccount.builder()
.putAdditionalProperty("type", JsonValue.from("bar"))
.putAdditionalProperty("project_id", JsonValue.from("bar"))
.putAdditionalProperty("private_key_id", JsonValue.from("bar"))
.putAdditionalProperty("private_key", JsonValue.from("bar"))
.putAdditionalProperty("client_email", JsonValue.from("bar"))
.putAdditionalProperty("client_id", JsonValue.from("bar"))
.putAdditionalProperty("auth_uri", JsonValue.from("bar"))
.putAdditionalProperty("token_uri", JsonValue.from("bar"))
.putAdditionalProperty("auth_provider_x509_cert_url", JsonValue.from("bar"))
.putAdditionalProperty("client_x509_cert_url", JsonValue.from("bar"))
.build())
.build();
DialogflowConnectionCreateResponse dialogflowConnection = client.dialogflowConnections().create(params);
}
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

dialogflow_connection = telnyx.dialogflow_connections.create(
"connection_id",
service_account: {
type: "bar",
project_id: "bar",
private_key_id: "bar",
private_key: "bar",
client_email: "bar",
client_id: "bar",
auth_uri: "bar",
token_uri: "bar",
auth_provider_x509_cert_url: "bar",
client_x509_cert_url: "bar"
}
)

puts(dialogflow_connection)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');

try {
$dialogflowConnection = $client->dialogflowConnections->create(
'connection_id',
serviceAccount: [
'type' => 'bar',
'project_id' => 'bar',
'private_key_id' => 'bar',
'private_key' => 'bar',
'client_email' => 'bar',
'client_id' => 'bar',
'auth_uri' => 'bar',
'token_uri' => 'bar',
'auth_provider_x509_cert_url' => 'bar',
'client_x509_cert_url' => 'bar',
],
conversationProfileID: 'a-VMHLWzTmKjiJw5S6O0-w',
dialogflowAPI: 'cx',
environment: 'development',
location: 'global',
);

var_dump($dialogflowConnection);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx dialogflow-connections create \
--api-key 'My API Key' \
--connection-id connection_id \
--service-account '{type: bar, project_id: bar, private_key_id: bar, private_key: bar, client_email: bar, client_id: bar, auth_uri: bar, token_uri: bar, auth_provider_x509_cert_url: bar, client_x509_cert_url: bar}'
curl --request POST \
--url https://api.telnyx.com/v2/dialogflow_connections/{connection_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"service_account": {
"type": "service_account",
"project_id": "your-project-id",
"private_key_id": "your-private-key",
"private_key": "-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----",
"client_email": "example@example.com",
"client_id": "your-client-id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/example%40example.iam.gserviceaccount.com"
},
"dialogflow_api": "cx",
"conversation_profile_id": "a-VMHLWzTmKjiJw5S6O0-w",
"location": "global",
"environment": "development"
}
'
{
  "data": {
    "record_type": "dialogflow_connections",
    "connection_id": "1234541231",
    "conversation_profile_id": "a-VMHLWzTmKjiJw5S6O0-w",
    "environment": "development",
    "service_account": "****"
  }
}
{
"errors": [
{
"code": "422",
"title": "Unprocessable Entity",
"detail": "The request parameters failed validation.",
"source": {
"pointer": "/service_account"
}
}
]
}
{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

connection_id
string
required

Uniquely identifies a Telnyx application (Call Control).

Body

application/json

The params expected to create/update a Dialogflow Connection for given connection_id.

service_account
object
required

The JSON map to connect your Dialoglow account.

dialogflow_api
enum<string>
default:es

Determine which Dialogflow will be used.

Available options:
cx,
es
Example:

"cx"

conversation_profile_id
string

The id of a configured conversation profile on your Dialogflow account. (If you use Dialogflow CX, this param is required)

Example:

"a-VMHLWzTmKjiJw5S6O0-w"

location
string

The region of your agent is. (If you use Dialogflow CX, this param is required)

Example:

"global"

environment
string

Which Dialogflow environment will be used.

Example:

"development"

Response

Return details of the Dialogflow connection associated with the given CallControl connection.

data
Dialogflow Connection · object
required