Skip to main content

HttpRequest

The <HttpRequest> verb sends a request to the external servers. It consists of 2 child nodes <Request> and <Response>

Attributes

ATTRIBUTEDESCRIPTIONOPTIONSDEFAULT
async Defines if TeXML process should wait for the request response. When it is set to false, the callback will be sent to the action URL, when the request is processed false
action Defines the action url that will be used to send the callback when the request is processed (only if async is set to false) -

Child verbs/nouns

NOUN/VERBDESCRIPTION
Request The <Request> node defines all the attributes of the request. It can have 2 child nodes <Headers> and <Body>
Response The <Response> node defines all the attributes of the response. It can have 2 child nodes <Headers> and <Body>

Examples

<Response>
<HttpRequest async=”true”>
<Request url="https://example.com" method="POST">
<Headers>
<Header>
<Key>Authorization</Key>
<Value>Bearer API_key</Value>
</Header>
<Header>
<Key>Content-Type</Key>
<Value>application/json</Value>
</Header>
</Headers>
<Body>
<![CDATA[
{
"from":{{From}}
}
]]>
</Body>
</Request>
</HttpRequest>
</Response>
<Response>
<HttpRequest async=”false” action="https://example.com">
<Request url="https://example.com" method="POST">
...
</Request>
<Response>
<Type>JSON</Type>
<StatusCode>200</StatusCode>
<Content>
<Field>
<Name>contact.name.first</Name>
<Value>first_name</Value>
</Field>
<Field>
<Name>contact.name.last</Name>
<Value>last_name</Value>
</Field>
</Content>
</Response>
</HttpRequest>
</Response>

Expected callbacks

{
"AccountSid": "cb6cfbbc-eb00-41af-a3f3-0d7b32009e4b",
"CallSid": "v2:7V3r4VFCGLTzKLOveE0-7vM9dX17-NRQgU1byo-uuOIX9JcDadLLKw",
"CallSidLegacy": "v2:7V3r4VFCGLTzKLOveE0-7vM9dX17-NRQgU1byo-uuOIX9JcDadLLKw",
"CustomerProperty1" : "value1",
"CustomerProperty2" : "value1",
}

Action callback attributes

The attributes contained in the action callback request to your URL.

ATTRIBUTEDESCRIPTION
AccountSidA unique identifier for the account generating this call.
CallSidA unique identifier for this call, generated by Telnyx.
CallSidLegacyA unique identifier for the call sent to keep backward compatibility.
CustomerProperty1A list of custom properties sent in response to the request in the body of it.