Add-ons are easy to use. After you install an Add-on and enable it for a specific Twilio product, all you have to do is consume the Add-on's results, which are returned as a JSON dictionary by the API specific to that product.
For some products — for example, Lookup — you are also required to specify which Add-on you'd like to use, and provide run-time data when you invoke the Twilio API. The table below summarizes how Add-ons are used and how to consume the Add-on results.
Use the AddOns parameter to specify the unique name of the Add-on to be invoked.Uses the format AddOns.<unique_name>.<parameter_name> to specify additional run-time data that may be required by the Add-on.
Add-on results are contained in the add_ons parameter in the response
All Add-ons enabled for this product in the Console are automatically invoked for each incoming SMS.Add-ons are currently not supported for outbound SMS
Add-on results are contained in the AddOns parameter in the Incoming SMS webhook.Result delivery is only supported on POST callbacks due to URL length constraints in GET callbacks
All Add-ons enabled for this product in the Console are automatically invoked for each incoming call.Add-ons are currently not supported for outbound calls
Add-on results are contained in the AddOns parameter in the Incoming Voice TwiML callback.Result delivery is only supported on POST callbacks due to URL length constraints in GET callbacks
All Add-ons enabled for this product in the Console are automatically invoked for each Recording
Availability of Add-on result is notified in the AddOns parameter in the callback to the URL specified in the Add-on Configuration Parameters
Synchronous Add-on results
For Add-ons that are synchronous in nature, such as most Lookup, Messaging, and Incoming Voice Add-ons, results are returned to you by the relevant Twilio API. They are returned as a JSON dictionary with the following format:
Parameter
Description
status
successful or fail
code
An error code if status is fail, else null. Add-on error codes are in the 61xxx range. See Error Reference page for details
message
A descriptive message that explains what went wrong, or null if status was successful
results
A JSON dictionary with the Add-on Unique Name as the key, and invocation results as the value
results dictionary details
Parameter
Description
request_sid
A unique identifier for a particular request made to the Add-on
status
successful or fail
code
An error code if status is fail, else null. Add-on error codes are in the 61xxx range. See Error Reference page for details
message
A descriptive message that explains what went wrong, or null if status was successful
result
Add-on specific results as a JSON object. For details about the contents of this field, refer to the Add-on specific documentation that can be found in the Add-on detail page in the Console
Performance considerations
Add-on Type
SLA/Latency
Size Limits
Phone Numbers and Message Analysis Add-ons
Because this request is returned synchronously, in the flow of an Incoming Call, Lookup or SMS delivery, performance is key. Any request taking longer than 2000ms will be failed by Twilio, an error payload will be sent, and the developer will not be billed
As a synchronous Add-on, the response for this is limited to a maximum of 64KB. Any response larger than this maximum will be failed by Twilio, an error payload will be sent, and the developer will not be billed
Example of a synchronous Add-on JSON response
Applies to Add-ons for Lookup, Incoming Voice Calls, Incoming SMS and Taskrouter
For Add-ons that are asynchronous, such as all Recording Add-ons, the availability of an Add-on result is indicated by an Add-on Results Available webhook issued as a POST request POST request to the Callback URL specified in the Add-on Configuration Parameters.
Add-on Results Available callback
The Add-on Results Available webhook body contains an AddOns parameter with a JSON dictionary in the following format:
Parameter
Description
status
successful or fail
code
An error code if status is fail, else null. Add-on error codes are in the 61xxx range. See Error Reference page for details
message
A descriptive message that explains what went wrong, or null if status was successful
results
A JSON dictionary with the Add-on Unique Name as the key, and the invocation results as the value
results dictionary details
Parameter
Description
request_sid
A unique identifier for a particular request made to the Add-on
status
successful or fail
code
An error code if status is fail, else null. Add-on error codes are in the 61xxx range. See Error Reference page for details
message
A descriptive message that explains what went wrong, or null if status was successful
payload
A list of dictionaries containing URIs for the actual results
links
A dictionary containing URIs for reference media, e.g., recordings, that was used to generate the results
payload dictionary format
Parameter
Description
content_type
The Mime type of the content returned by the Add-on, such as application/json or audio/wav. See the Add-on documentation for details of the content it returns
url
A URL at which you can access the content itself. This is the Add-on Result Payload Data as outlined in the Add-on Results API. You will need to perform an authenticated GET using your Twilio credentials to retrieve this data
The URL of the Add-on Result instance metadata. See the Add-on Results API for details
payloads
The URL of the Add-on Result Payloads list metadata. See the Add-on Results API for details
Performance considerations
Add-on Type
SLA/Latency
Size Limits
Recording Analysis Add-on
Because this request is returned asynchronously, there are no hard performance requirements. These Add-ons should return in a median time of 3x audio duration and a 99% under 5x audio duration. Any request taking longer than 10x duration will be failed by Twilio, an error payload will be sent, and the developer will not be billed
As an an asynchronous Add-on, this response for this is limited to a maximum of 100MB. Any response larger than this maximum will be failed by Twilio, an error payload will be sent, and the developer will not be billed
Example of an asynchronous Add-on Results Available callback
Applies to callbacks received for Recording Analysis Add-ons. Note that this JSON is contained within the 'AddOns' POST parameter.
The results produced by Asynchronous Add-ons, such as Recording Add-ons, are only available for 30 days. They can be access using the Add-on Results API.