Skip to main content

AIGather

The <AIGather> verb collects specific information from call participants, leveraging AI. It requires the child node <Parameters> to be provided with a JSON Schema object that describes the parameters to be gathered.

Attributes

ATTRIBUTEDESCRIPTIONOPTIONSDEFAULT
action URL where TeXML will send the gathered speech input. The same method (GET/POST) as set for the TeXML application is used. Transfers control of the current call to the TeXML file returned. -
method HTTP request type used to retrieve the next set of instructions. GET, POST POST

Child verbs/nouns

NOUN/VERBDESCRIPTION
Greeting Reads supplied text back to the caller when the gathering starts, if none, then nothing will be played when the gathering starts.
Voice The voice to be used by the voice assistant.
Parameters
MessageHistory

Examples

<Response>
<AIGather action="https://example.com/aigather">
<Greeting>Hello, please provide your age and location.</Greeting>
<Voice name="Polly.Joanna"/>
<Parameters>
<![CDATA[
{
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The location of the user"
},
"age": {
"type": "number",
"description": "The age of the user"
}
},
"required": ["location", "age"]
}
]]>
</Parameters>
<MessageHistory>
<Message role="assistant">Hello, what's your name?</Message>
<Message role="user">Hi, I'm Enzo.</Message>
</MessageHistory>
</AIGather>
</Response>

Expected callbacks

If action is set, the following callbacks are expected:

action

{
"AccountSid": "cb6cfbbc-eb00-41af-a3f3-0d7b32009e4b",
"CallSid": "v2:DPNqxVjTNtQYaKdcKbU0QgRFrQ3YzuAQrVYC4Ggcuq7zTpDkUB7A4w",
"CallSidLegacy": "v2:DPNqxVjTNtQYaKdcKbU0QgRFrQ3YzuAQrVYC4Ggcuq7zTpDkUB7A4w",
"From": "Defaultj35z6@sip.telnyx.com",
"To": "+12132045020",
"Result": {
"age": 29,
"location": "Paris"
},
"MessageHistory": [
{
"role": "assistant",
"text": "Hello, what's your name?"
},
{
"role": "user",
"text": "Hi, I'm Enzo."
},
{
"role": "assistant",
"text": "Hello, please provide your age and location."
},
{
"role": "user",
"text": "Hi, I'm 29 and I live in Paris."
}
]
}

Status callback attributes

If statusCallbackEvent is set, the following webhooks are expected.

ATTRIBUTEDESCRIPTION
AccountSidA unique identifier for the account generating this call.
CallSidA unique identifier for this call, generated by Telnyx.
FromThe outbound caller number.
ToThe inbound callee number.
ResultThe result of the AI gather, its type depends on the parameters provided in the command.
MessageHistoryThe history of the messages exchanged during the AI gather. It also includes any messages passed in the MessageHistory of the AIGather verb.