Webhook Bots Guide
Webhook Bots Guide
Eliminate time-consuming tasks and reduce human errors by transferring information to the
third-party systems you need. Keep all the information up-to-date with airSlate's no-code
webhook Bots.
2
Table of Contents
Send Webhook upon Documents Opening Bot 3
Installation 3
Response body parameters 7
Webhook response 8
Webhook requests 9
Fetch 9
Subscription 10
Delete 12
Statistics 13
Code examples 14
PHP code 14
Node.js code 15
Installation
1. Find the Send Webhook upon Slate Opening Bot and click the Install Bot button to add the Bot to your
Flow.
2. In your Postman account (or any other console), copy the Authorization token from the infobox and
paste it as the Authorization header value.
🗒 Note: The slate_addons will have a single token within different Flow versions. Using this token,
users will be able to access the data from all slate_addons and different Flow versions.
The Bot operates within versioning. If the versioning doesn’t display, it means that your Flow only has
one version by default that is always up to date. Versioning will become available right after you create
another Flow version.
3. Configure the Bot execution conditions and Advanced settings as needed. Press Apply setup when
finished.
POST https://hostname/webhook-bot/v2/subscription
Headers: Authorization: {authorization_token}
Request body:
{
"data" : {
"type" : "subscriptions",
"attributes": {
"callback_url" : "callback_url"
}
}
}
Hostname:
bots.airslate.com — the hostname that should be used in subsequent requests instead of the {hostname}
placeholder for US-based services.
Example:
POST https://bots.airslate.com/webhook-bot/v2/subscription
bots.airslate-au.com — the hostname that should be used in subsequent requests instead of the {hostname}
placeholder for AU-based services.
{
"data": {
"type": "subscriptions",
"id": "A88CB620-0000-0000-00002D5D",
"attributes": {
"callback_url": "https://automation.pdffillers.com/report/whprefill"
},
"relationships": {
"slates": {
"data": {
"type": "slates",
"id": "B2D12859-9300-0000-0000BA29"
}
},
"slate_addons": {
"data": {
"type": "slate_addons",
"id": "51131C22-A700-0000-000093F0"
}
},
"flow_revisions": {
"data": {
"type": "flow_revisions",
"id": "6602784C-9300-0000-000049B7"
}
}
}
200 — the request was received. The response body will contain the subscription information such as
subscription, Flow, and Bot IDs.
400 — the request failed due to incorrect input parameters. Verify the request body. It might be missing or its
attributes’ values are wrong.
401 — the request failed due to authorization issues. Verify the Authorization header. It might be missing or its
value is wrong. Ensure the Authorization token matches your request token and resend the request.
403 — the request is forbidden since the Bot was disabled. Enable the Bot and resend the request.
Webhook response
Every time the Bot is triggered by creating a Slate or Revision, a webhook that contains the data needed to get
a specific document is sent in a POST request to the {callback_url} of your service.
flow_id — the unique Flow identifier where a Slate was opened, or Revision created.
slate_addon_id — the unique identifier of the Bot set up in a particular Flow.
slate_id — the unique identifier of the opened Slate.
revision_id — the unique identifier of the opened Slate Revision.
organization_id — the unique identifier of your Workspace.
🗒 Note: If the service is currently unavailable or the response code to the webhook request is not 200,
the Bot will try to send the webhook three times at one-hour intervals. You can always check the status of
the webhook in the Bots log section.
Webhook requests
Fetch
Send a GET request to the /webhook-bot/fetch endpoint to retrieve every document from all Slates and their
Revisions for which the Bot has sent webhooks. You can also filter the documents by a particular Slate
ID/Revision ID/Flow Revision ID. The response body will contain a list of filtered documents, their fields, and an
extended list of the fields’ attributes.
Request example:
GET https://hostname/webhook-bot/v2/fetch?filter[slate_id]={slate_id_1}&filter[revision_id]={revision_id_1}
Request parameters:
filter[slate_id] — the request parameter which allows for filtering documents by a specific Slate ID —
{slate_id_1}.
filter[revision_id] — the request parameter which allows for filtering documents by a specific Revision ID —
{revision_id_1}.
filter[flow_revision_id] — the request parameter which allows for filtering documents by a specific Flow revision
ID — {flow_revision_id_1}.
200 — the request was received. The response body will contain a list of filtered documents, their fields, and
an extended list of the fields’ attributes.
401 — the request failed due to authorization issues. Verify the Authorization header. It might be missing or its
value is wrong. Ensure the Authorization token matches your request token and resend the request.
Response example:
Subscription
Send a GET request to the /webhook-bot/v2/subscription endpoint to review the active subscriptions of the Bot.
Request example:
GET https://{hostname}/webhook-bot/v2/subscription
Headers: Authorization: {authorization_token}
Response example:
"flow_revisions": {
"data": {
"type": "flow_revisions",
"id": "4BDA29C6-7100-0000-000049B7"
}
}
]
}
200 — the request was received. The response body will contain the subscription data: subscription ID
(data.id), callback URL (data.callback_url), Flow ID (slates.data.id), and Bot ID (slate_addons.data.id).
401 — the request failed due to authorization issues. Verify the Authorization header. It might be missing or its
value is wrong. Ensure the Authorization token matches your request token and resend the request.
Delete
Request example:
DELETE https://{hostname}/webhook-bot/v2/subscription/{subscription_id}
Headers: Authorization: {authorization_token}
Response example:
subscription_id — value of the data.id attribute from the subscription response body.
204 — the request was received and processed by the service. You have unsubscribed from receiving
webhooks.
400 — the request failed due to incorrect input parameters. Verify the {subscription_id}. It might be missing or
its value is wrong.
Statistics
Retrieve a list of webhooks sent by the Bot by sending the GET request to the /webhook-bot/stats endpoint.
Request example:
GET https://{hostname}/webhook-bot/stats
Headers: Authorization: {authorization_token}
"status": "success"
}
]
},
{
"slate_id": "C86D5866-6000-0000-0000C9C1", "revision_id": "011AB071-8000-0000-00005363",
"flow_revision_id": "4BDA29C6-7100-0000-000049B7","webhooks": [
{
"notified_at": 1578920763,
"status": "success"
}
]
}
]
Send the GET request to the /webhook-bot/stats endpoint with the corresponding request parameters to
retrieve the list of webhooks sent by the Bot and filtered by a Slate ID/Revision ID/Flow Revision ID.
Request example:
Request parameters:
Code examples
Please find below the PHP and Node.js code examples for the requests described above.
PHP code
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$url = '/webhook-bot/v2/subscription';
$statsUrl = '/webhook-bot/stats';
$body = ["data" => ["type" => "subscriptions", "attributes" => ["callback_url" =>
'https://your-callback-url']]];
// Add new subscription
Node.js code
const https = require('https');
// Add new subscription
const subscribeReq = https.request({
hostname: 'bots.airslate.com',
path: '/webhook-bot/v2/subscription',
method: 'POST',
headers: {
Authorization:'your-token'
}
},
res => {
res.on('data', d => process.stdout.write(d))
}
);
const data = new TextEncoder().encode(
JSON.stringify({
data: {
type: 'subscriptions',
attributes: {
callback_url: 'https://your-callback-url-t'
}
}
})
);
subscribeReq.write(data); subscribeReq.end();
// Review subscriptions
const viewReq = https.request({
hostname: 'bots.airslate.com',
path: '/webhook-bot/v2/subscription',
method: 'GET',
headers: {
Authorization: 'your-token'
}
},
res => {
res.on('data', d => process.stdout.write(d))
}
);
viewReq.end();
// Unsubscribe
const deleteReq = https.request({
hostname: 'bots.airslate.com',
path: '/webhook-bot/v2/subscription/{UID}',
method: 'DELETE',
headers: {
Authorization: 'your-token'
}
},
res => {
res.on('data', d => process.stdout.write(d))
}
);
deleteReq.end();
Installation
1. Find the Send Webhook on Document Completion Bot and click the Install Bot button to add the Bot to
your Flow.
2. In your Postman account (or any other console), copy the Authorization token from the infobox and
paste it as the Authorization header value.
1. The slate_addons will have a single token within different Flow versions. Using this token, users will be
able to access the data from all slate_addons and different Flow versions.
2. The Bot operates within versioning. If versioning doesn’t display, it means that your Flow only has one
version by default that is always up to date. Versioning will become available right after you create
another Flow version.
3. Configure the Bot execution conditions and Advanced settings as needed. Press Apply setup when
finished.
Hostname:
bots.airslate.com — the hostname that should be used in subsequent requests instead of the {hostname}
placeholder for US-based services.
bots.airslate-au.com — the hostname that should be used in subsequent requests instead of the {hostname}
placeholder for AU-based services.
Response body
},
"slate_addons": {
"data": {
"type": "slate_addons",
"id": "86E801EB-7300-0000-000093F0"
}
},
"flow_revisions": {
"data": {
"type": "flow_revisions",
"id": "4BDA29C6-7100-0000-000049B7"
}
}
}
}
}
200 — the request was received. The response body will contain the subscription information such as
subscription, Flow, and Bot IDs.
400 — the request failed due to incorrect input parameters. Verify the request body. It might be missing or its
attributes’ values are wrong.
401 — the request failed due to authorization issues. Verify the Authorization header. It might be missing or its
value is wrong. Ensure the Authorization token matches your request token and resend the request.
403 — the request is forbidden since the Bot was disabled. Enable the Bot and resend the request.
Parametrs
Webhook response
Every time the Bot is triggered (when an airSlate user completes documents), a webhook that contains the
data needed to get a completed document, will be sent in a POST request to the {callback_url} of your service.
flow_id — the unique Flow identifier where documents from the Slate were completed, and Revisions created.
slate_addon_id — the unique identifier of the Bot set up in a particular Flow. slate_id — the unique identifier of
the Slate where documents were completed.
revision_id — the unique identifier of the Slate Revision where documents were completed.
organization_id — the unique identifier of your Workspace.
Note: If the service is currently unavailable or the response code to the webhook request is not 200, the Bot
will try to send the webhook three times at one-hour intervals. You can always check the status in the Bots log
section.
Webhook requests
Fetch
Send a GET request to the /webhook-bot/fetch endpoint to retrieve every document from all Slates and their
Revisions for which the Bot has sent webhooks. You can also filter the documents by a particular Slate
ID/Revision ID/Flow Revision ID. The response body will contain the list of filtered documents, their fields, and
an extended list of the fields’ attributes.
Request example:
Parameters
filter[slate_id] — the request parameter which allows for filtering documents by a specific Slate ID —
{slate_id_1}.
filter[revision_id] — the request parameter which allows for filtering documents by a specific Revision ID —
{revision_id_1}.
filter[flow_revision_id] — the request parameter which allows for filtering documents by a specific Flow revision
ID — {flow_revision_id_1}.
200 — the request was received. The response body will contain a list of filtered documents, their fields, and
an extended list of the fields’ attributes.
401 — the request failed due to authorization issues. Verify the Authorization header. It might be missing or its
value is wrong. Ensure the Authorization token matches your request token and resend the request.
Subscription
Send the GET request to the /webhook-bot/v2/subscription endpoint to review the active subscriptions of the
Bot.
Request example
GET https://{hostname}/webhook-bot/v2/subscription
Headers: Authorization: {authorization_token}
Response example
Parameters
200 — the request was successfully received. The response body will contain the subscription data:
subscription ID (data.id), callback URL (data.callback_url), Flow ID (slates.data.id), and Bot ID
(slate_addons.data.id).
401 — the request has failed due to authorization issues. Verify the Authorization header. It might be missing
or its value is wrong. Ensure the Authorization token matches your request token and resend the request.
Delete
Request example:
DELETE https://hostname/webhook-bot/v2/subscription/subscription_id
Headers: Authorization: {authorization_token}
204 — the request was received and processed by the service. You have unsubscribed from receiving
webhooks.
400 — the request failed due to incorrect input parameters. Verify the {subscription_id}. It might be missing or
its value is wrong.
Response example:
Statistics
Get a list of webhooks sent by the Bot by sending the GET request to the /webhook-bot/stats endpoint.
Request example:
GET https://{hostname}/webhook-bot/stats
Headers: Authorization: {authorization_token}
Response example
"status": "success"
}
]
},
{
"slate_id": "C86D5866-6000-0000-0000C9C1",
"revision_id": "011AB071-8000-0000-00005363",
"flow_revision_id": "4BDA29C6-7100-0000-000049B7",
"webhooks": [
{
"notified_at": 1578920763,
"status": "success"
}
]
}
]
200 — the request was received. The response body will contain the list of webhooks sent by the Bot.
401 — the request failed due to authorization issues. Verify the Authorization header. It might be missing or its
value is wrong. Ensure the Authorization token matches your request token and resend the request.
Send the GET request to the /webhook-bot/stats endpoint with the corresponding request parameters to
retrieve the list of webhooks sent by the Bot and filtered by a Slate ID/Revision ID/Flow Revision ID.
Request example
GET https://{hostname}/v2/stats?filter[slate_ids]={slate_id_1}&filter[revision_ids]={rev
ision_id_1}&filter[flow_revision_ids]={flow_revision_id_1}
Headers: Authorization: {authorization_token}
Parameters:
Code Examples
Please find below the PHP and Node.js code examples for the requests described above.
PHP code
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://bots.airslate.com/', 'headers' => ['Authorization' => 'your-token']]);
$url = '/webhook-bot/v2/subscription';
$statsUrl = '/webhook-bot/stats';
$body = ["data" => ["type" => "subscriptions", "attributes" => ["callback_url" =>'https://your-callback-url']]];
// Add new subscription
$subscribeResponse = $client->post($url, ['json' => $body]);
// Review subscriptions
$viewResponse = $client->get($url);
echo $viewResponse->getBody()
->getContents();
// Unsubscribe
$id = json_decode($subscribeResponse->getBody()
->getContents() , true) ['data']['id'];
$client->delete($url . '/' . $id);
// Review webhook statistics
$statsResponse = $client->get($statsUrl);
echo $statsResponse->getBody()
->getContents();
Node.js code
}
);
viewReq.end();
// Unsubscribe
const deleteReq = https.request({
hostname: 'bots.airslate.com',
path: '/webhook-bot/v2/subscription/{UID}',
method: 'DELETE',
headers: {
Authorization: 'your-token'
}
},
res => {
res.on('data', d => process.stdout.write(d))
}
);
deleteReq.end();
// Review webhook statistics
const statsReq = https.request({
hostname: 'bots.airslate.com',
path: '/webhook-bot/v2/stats',
method: 'GET',
headers: {
Authorization:'your-token'
}
},
res => {
res.on('data', d => process.stdout.write(d))
} );
statsReq.end();
Supported documents:
● Uploaded PDF documents
● Form or Survey
● Document generation
● Contract
● Spreadsheet
● Initials
● Image
Installation
1. Right after you’ve visualized your workflow, click the Flow Start block and then click Add autostart.
3. In your Postman account (or any other console), copy the Authorization token from the infobox and
paste it as the Authorization header value.
4. Indicate the alias of the respective field indicated in the Bot settings scheme which will be used as the
id attribute.
An alias may contain letters, digits, “_”, “-”, and quotation marks. Its maximum length is 35 characters and the
minimum length is 3 characters.
Example:
POST https://hostname/slate-creation-from-event-bot/create-slate
Headers: Authorization : {authorization_token}
Request body:
{
"data" : {
"type": "slate_creation_requests",
"attributes": {
"callback_url" : {callback_url}
}
},
"meta": {
"fields": [
{
"id": "field1",
bots.airslate.com — the hostname that should be used in subsequent requests instead of the {hostname}
placeholder for US-based services.
bots.airslate-au.com — the hostname that should be used in subsequent requests instead of the {hostname}
placeholder for AU-based services.
callback_url — the service URL which will receive a webhook.
data.type — parameter with the predefined slate_creation_requests value.
meta.fields — an array of fields with their attributes and pre-fill values. {callback_url} — the service URL which
will receive a POST request when the Slate is created and pre-filled (the Slate creation status — is_completed:
true).
Taking into account the validation rules — the field_type and the extended set of field attributes — add the
pre-fill data for each field to the corresponding value attributes.
You can create Slates from the latest Flow version or from a draft Flow version. To create a Slate from a draft
version, indicate meta.use_draft_flow:true.
201 — the request for Slate creation and pre-filling was successfully submitted. The response body will contain
the unique Slate creation id — {request_id} and the operation status in the data.attributes.is_completed
property.
403 — the request failed due to authorization issues. Verify the Authorization header. It might be missing or its
value is wrong. Ensure the Authorization token matches your request token and resend the request.
Response example
Slate creation
Usually it takes a minute to create a pre-filled Slate in a Flow. To check the Slate creation status, send a GET
request to the
/slate-creation-from-event-bot/create-slate/{request_id} endpoint.
{request_id} — unique Slate creation ID. Replace the {request_id} placeholder with the id attribute value of the
create and pre-fill Slate response JSON.
Request example
GET https://bots.airslate.com/slate-creation-from-event-bot/create-slate/{request_id}
Headers: Authorization : {authorization_token}
Code Examples
Please find below the PHP and Node.js code examples for the requests described above.
PHP code
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$createSlateUrl = '/slate-creation-from-event-bot/create-slate';
$requestID = json_decode($createSlateResponse->getBody()
->getContents() , true) ['data']['id'];
echo $slateStatusResponse->getBody()
->getContents();
Node.js code
const https = require('https');
hostname: 'bots.airslate.com',
path: '/slate-creation-from-event-bot/create-slate',
method: 'POST',
headers: {
Authorization: '{authorization_token}'
}
},
res => {
res.on('data', d => process.stdout.write(d))
}
);
const data = new TextEncoder().encode(
JSON.stringify({
data: {
type: 'slate_creation_requests',
attributes: {
callback_url: 'https://{callback_url}'
}
},
meta: {
fields: [ {
id: '{FIELD_ALIAS}',
value: 'value'
}
]
}
})
);
slateCreateReq.write(data);
slateCreateReq.end();
hostname: 'bots.airslate.com',
path: '/slate-creation-from-event-bot/create-slate/{request_id}',
method: 'GET',
headers: {
Authorization: '{authorization_token}'
}
},
res => {
res.on('data', d => process.stdout.write(d))
}
);
statusReq.end();