Skip to contentSkip to navigationSkip to topbar
On this page

Authy Webhooks API


(warning)

Warning

As of November 2022, Twilio no longer provides support for Authy SMS/Voice-only customers. Customers who were also using Authy TOTP or Push prior to March 1, 2023 are still supported. The Authy API is now closed to new customers and will be fully deprecated in the future.

For new development, we encourage you to use the Verify v2 API.

Existing customers will not be impacted at this time until Authy API has reached End of Life. For more information about migration, see Migrating from Authy to Verify for SMS(link takes you to an external page).

Set a webhook to be called after a publicly visible event happens and improve insight into your Authy application's usage. The API has three endpoints:

(information)

Info

Twilio can send your web application an HTTP request when certain events happen, such as an incoming text message to one of your Twilio phone numbers. These requests are called webhooks, or status callbacks. For more, check out our guide to Getting Started with Twilio Webhooks. Find other webhook pages, such as a security guide and an FAQ in the Webhooks section of the docs.


Signing Requests

signing-requests page anchor

All Webhook API requests require the X-Authy-Signature header. These are the steps required to generate the header and sign a request:

1. Create a string variable using the URL without parameters:

url = "https://api.authy.com/dashboard/json/application/webhooks"

2. Create a string variable with the HTTP method in upper case (GET, POST, DELETE):

http_method = "POST"

3. Sort the list of parameters in case-sensitive order and convert them to URL format

Both key and value should be URL-encoded.

1
params = {b: "val|ue&2", a: "value1"}
2
sorted_params = "a=value1&b=val%7Cue%262"

4. Generate a unique nonce(link takes you to an external page)

Your language of choice likely has a nonce generator library, such nonce(link takes you to an external page) in Node.js.

nonce = "1427849783.886085"

5. Join nonce, http_method, url and params_in_url_format together with the | character:

Note: the string should contain exactly 3 | characters.

1
data = nonce + "|" + http_method + "|" + url + "|" + params_in_url_format
2
"1427849783.886085|POST|https://api.authy.com/dashboard/json/application/webhooks|a=value1&b=val%7Cue%262"

6. Hash the resulting data using HMAC-SHA256, using your api_signing_key as the key:

Get your API signing key from "Webhooks API Keys" section of the application settings tab in the Twilio Console(link takes you to an external page).

digest = hmac_sha256(data, api_signing_key)

7. Base64 encode the digest:

Base64 encoding should not contain line feeds. It must be encoded as described in the RFC 4648(link takes you to an external page).

digest_in_base64 = encode_in_base64(digest)

8. Make the HTTP request with specified headers

Send the digest_in_base64 in the X-Authy-Signature header

Send the nonce in the X-Authy-Signature-Nonce header.

1
request.headers["X-Authy-Signature"] = digest_in_base64
2
request.headers["X-Authy-Signature-Nonce"] = nonce
3
make_request(request)

Webhook API requests require the app_api_key and access_key parameters. Signing the request (step 6 above) requires the api_signing_key. These are found in the application settings tab in the Twilio Console.(link takes you to an external page)

Authy settings webhooks API keys.

POST https://api.authy.com/dashboard/json/application/webhooks

Parameters

create-webhook-parameters page anchor
NameTypeDescription
urlstringThe callback URL to receive registered events in the webhook (🏢 not PII )
eventsarray stringThe list of events to monitor by the webhook. See available events (🏢 not PII )
namestringIdentifying name for your webhook. (🏢 not PII )
app_api_keystringFound in the application settings tab in the Twilio Console.(link takes you to an external page) See webhooks API keys. (🏢 not PII )
access_keystringFound in the application settings tab in the Twilio Console.(link takes you to an external page) See webhooks API keys. (🏢 not PII )
NameTypeDescription
webhookobjectDetails about the created webhook. See below for more details. (🏢 PII )
messagestringAuthy API response description. (🏢 PII )
successBooleanReturns true if the request was successful. (🏢 not PII )

The response will be JSON with the following structure:

1
webhook: webhook object
2
id: Webhook id
3
name: Webhook name
4
account_sid: Twilio owner account id
5
service_id: Authy application serial id
6
url: Callback url
7
signing_key: The key to verify JWT response received by the callback url
8
events: List of events which will trigger webhook callbacks
9
objects: Objects involved in the event. This is specific by event type.
10
creation_date: Date in which webhook was created
11
message: Authy api response message
12
success: Whether yes or no request was success
Create an Authy WebhookLink to code sample: Create an Authy Webhook
1
curl -X POST "https://api.authy.com/dashboard/json/application/webhooks" \
2
-d name="my webhook" \
3
-d app_api_key=""tLPrf... \
4
-d access_key="usQ4z..." \
5
-d url="https://example.com/callback-action" \
6
-d events[]="phone_verification_started" \
7
-H "X-Authy-Signature-Nonce: 1427849783.886085" \
8
-H "X-Authy-Signature: 5RgJYUuz9m/rhi6XPjAjKUtNOJqPgMnP9GKBqWJEGFg="

Output

1
{
2
"webhook": {
3
"id": "WH_0c04...",
4
"name": "my webhook",
5
"account_sid": "ACec7...",
6
"service_id": "56...",
7
"url": "https://example.com/callback-action",
8
"signing_key": "WSK_ovh...",
9
"events": ["phone_verification_started"],
10
"creation_date": "2017-03-30T20:10:37.121+00:00"
11
},
12
"message": "Webhook created",
13
"success": true
14
}

Webhooks can be configured for the following events:

The following events are specific to our legacy phone verification API. Please consider upgrading to Verify V2:


DELETE https://api.authy.com/dashboard/json/application/webhooks/:webhook_id
NameTypeDescription
webhook_idStringThe webhook id (🏢 not PII )
NameTypeDescription
messagestringAuthy API response description. (🏢 PII )
successBooleanReturns true if the request was successful. (🏢 not PII )
1
curl -X DELETE "https://api.authy.com/dashboard/json/application/webhooks/WH_0c04..." \
2
-d app_api_key=""tLPrf... \
3
-d access_key="usQ4z..." \
4
-H "X-Authy-Signature-Nonce: 1427849783.886085" \
5
-H "X-Authy-Signature: QB+u2hFTj+fstAEbSUQUfA7409uKJTL2W17MrRuk3OE="

Output

1
{
2
"message": "Webhook deleted",
3
"success": true
4
}

GET https://api.authy.com/dashboard/json/application/webhooks

This endpoint does not require parameters.

NameTypeDescription
webhooksarrayArray of webhook objects. See examples for detailed response structure. (🏢 PII )
successBooleanReturns true if the request was successful. (🏢 not PII )
1
curl -X GET https://api.authy.com/dashboard/json/application/webhooks \
2
-d app_api_key="tLPrf..." \
3
-d access_key="usQ4z..." \
4
-H "X-Authy-Signature-Nonce:1427849783.886085" \
5
-H "X-Authy-Signature: QB+u2hFTj+fstAEbSUQUfA7409uKJTL2W17MrRuk3OE="

Output

1
{
2
"webhooks":[
3
{
4
"id":"WH_0c04...",
5
"name":"my webhook",
6
"account_sid":"ACec7...",
7
"service_id":"56...",
8
"url":"https://example.com/callback-action",
9
"signing_key":"WSK_ovh...",
10
"events":[
11
"phone_verification_started"
12
],
13
"creation_date":"2018-03-30T20:10:37.121+00:00"
14
},
15
{
16
"id":"WH_0c05...",
17
"name":"my other webhook",
18
"account_sid":"ACec7...",
19
"service_id":"57...",
20
"url":"https://example.com/callback-action",
21
"signing_key":"WSK_ivf...",
22
"events":[
23
"phone_verification_started"
24
],
25
"creation_date":"2018-03-30T20:10:37.121+00:00"
26
}
27
],
28
"success":true
29
}

You can find more examples of how to use Authy Webhooks in the Node implementation of the webhooks API(link takes you to an external page) on Github.


The Twilio Authy webhooks service will send a callback every time a registered event occurs. The response will be coded in JWT and signed with the signing_key for the registered webhook. Use that signing_key to validate the response when you decode it.

Visit this page for more information on validating webhooks.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.