Speak in a meeting session
Sends audio / text-to-speech into a meeting session. With a Telnyx AI Assistant attached, wait for the assistant to connect before requesting speech. If audio delivery fails, the response can be 502, which may arrive without an error envelope, so branch on the status code before parsing a body. The assistant is designed to own the conversation, so prefer letting it speak or use send_chat. With a digital avatar (assistant.avatar: true), speak is refused with 409 invalid_state (message prefix avatar_requires_assistant_speech:): the avatar renders only the assistant’s own speech.
POST
/
meeting_sessions
/
{id}
/
actions
/
speak
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.meetingSessions.actions.speak('id', {
text: 'text',
});
console.log(response.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
)
response = client.meeting_sessions.actions.speak(
id="id",
text="text",
)
print(response.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"),
)
response, err := client.MeetingSessions.Actions.Speak(
context.TODO(),
"id",
telnyx.MeetingSessionActionSpeakParams{
Text: "text",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.meetingSessions.actions.ActionSpeakParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ActionSpeakParams params = ActionSpeakParams.builder()
.text("text")
.build();
var response = client.meetingSessions().actions().speak("id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.meeting_sessions.actions.speak("id", text: "text")
puts(response)<?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 {
$response = $client->meetingSessions->actions->speak(
'id',
text: 'text',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx meeting-sessions:actions speak \
--api-key 'My API Key' \
--id id \
--text textcurl --request POST \
--url https://api.telnyx.com/v2/meeting_sessions/{id}/actions/speak \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Here are the three decisions from this call.",
"interrupt": false
}
'{
"data": {
"accepted": true
}
}{
"error": {
"code": "invalid_request",
"message": "request is invalid"
}
}{
"error": {
"code": "unauthorized",
"message": "invalid or missing credentials"
}
}{
"error": {
"code": "forbidden",
"message": "credential is not permitted"
}
}{
"error": {
"code": "not_found",
"message": "meeting session not found"
}
}{
"error": {
"code": "invalid_state",
"message": "only scheduled sessions can be updated"
}
}{
"error": {
"code": "invalid_request",
"message": "request body too large"
}
}{
"error": {
"code": "unsupported_capability",
"message": "avatar video is not supported on platform 'unknown'"
}
}{
"error": {
"code": "auth_overloaded",
"message": "authentication temporarily overloaded"
}
}{
"error": {
"code": "internal_error",
"message": "internal server error"
}
}{
"error": {
"code": "tts_error",
"message": "tts synthesis failed"
}
}{
"error": {
"code": "not_configured",
"message": "required feature is not configured"
}
}Authorizations
Path Parameters
Body
application/json
Text for the bot to speak.
Required string length:
1 - 4000Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.meetingSessions.actions.speak('id', {
text: 'text',
});
console.log(response.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
)
response = client.meeting_sessions.actions.speak(
id="id",
text="text",
)
print(response.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"),
)
response, err := client.MeetingSessions.Actions.Speak(
context.TODO(),
"id",
telnyx.MeetingSessionActionSpeakParams{
Text: "text",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.meetingSessions.actions.ActionSpeakParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ActionSpeakParams params = ActionSpeakParams.builder()
.text("text")
.build();
var response = client.meetingSessions().actions().speak("id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.meeting_sessions.actions.speak("id", text: "text")
puts(response)<?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 {
$response = $client->meetingSessions->actions->speak(
'id',
text: 'text',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx meeting-sessions:actions speak \
--api-key 'My API Key' \
--id id \
--text textcurl --request POST \
--url https://api.telnyx.com/v2/meeting_sessions/{id}/actions/speak \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Here are the three decisions from this call.",
"interrupt": false
}
'{
"data": {
"accepted": true
}
}{
"error": {
"code": "invalid_request",
"message": "request is invalid"
}
}{
"error": {
"code": "unauthorized",
"message": "invalid or missing credentials"
}
}{
"error": {
"code": "forbidden",
"message": "credential is not permitted"
}
}{
"error": {
"code": "not_found",
"message": "meeting session not found"
}
}{
"error": {
"code": "invalid_state",
"message": "only scheduled sessions can be updated"
}
}{
"error": {
"code": "invalid_request",
"message": "request body too large"
}
}{
"error": {
"code": "unsupported_capability",
"message": "avatar video is not supported on platform 'unknown'"
}
}{
"error": {
"code": "auth_overloaded",
"message": "authentication temporarily overloaded"
}
}{
"error": {
"code": "internal_error",
"message": "internal server error"
}
}{
"error": {
"code": "tts_error",
"message": "tts synthesis failed"
}
}{
"error": {
"code": "not_configured",
"message": "required feature is not configured"
}
}