Speak in a meeting session
Sends audio / text-to-speech into a meeting session. With a Telnyx AI Assistant (or avatar) attached, the bot is a webpage-output bot: the speak audio routes through the assistant’s output page rather than the bot mic and plays once the assistant is connected — it is not refused. If that page cannot be reached, delivery fails with the 502 below, 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.
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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier for the meeting session.
"mtgsess_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Body
Text for the bot to speak.
1 - 4000Voice identifier to use for this utterance. When supplied, it overrides the session-default voice configured at creation; otherwise the speak action uses that session default.
1 - 100If true, interrupt any currently playing audio to speak this text immediately.
Response
The speak action was accepted and is being processed.
Show child attributes
Show child attributes
Was this page helpful?
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"
}
}