The Autostart from external event endpoint enables users to run new workflows pre-filled with custom data from external events. It's triggered by a POST request from the external service to the respective endpoint.
Supported documents:
Uploaded PDF documents
Form or survey
Document generation
Contract
Spreadsheet
You can pre-fill all field types except:
Signature
Initials
Image
Installation
1. Right after you’ve visualized your workflow, click on the gear icon at the start of your workflow.
Then, click Add autostart on the sidebar.
2. Select From external event option.
3. In the infobox, you’ll find the Authorization token, which you will need for all API requests related to this autostart.
Copy it and paste it as the Authorization header value in Postman or any other console of your choice.
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.
Make a request
Send a POST request /slate-creation-from-event-bot/create-slate for the workflow run.
Example:
curl
--request POST \
--url ' https://bots.airslate.com/slate-creation-from-event-bot/create-slate' \
--header 'Authorization: {{authorization_token}}' \
Request body:
{
"data" : {
"type": "slate_creation_requests",
"attributes": {
"callback_url" : {callback_url}
}
},
"meta": {
"fields": [
//id - {{fieldalias indicated in the addon settings scheme}}
{
"id": "field1",
"value": "Pre-fill text value"
},
//Configure the pre-fill of the field_type: arrayfieldwith objects {
"id": "field2",
"value": [
},
{
Hostname:
bots.airslate.com — the hostname that should be used in subsequent requests for US-based services.
bots.airslate-au.com — the hostname that should be used in subsequent requests for AU-based services.
{*Note: Attribute ‘slate’ in all subsequent parameters refers to document.*}
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 workflow is run 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 run workflow from the latest workflow version or from a drafted workflow version. To run workflow from a draft version, indicate “use_draft_flow": true.
Status code of the response:
201 — the request to run workflow and pre-filling was successfully submitted. The response body will contain the unique workflow 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:
Status code: 200
Document is not created
Response body:
{
"data": {
"type": "slate_creation_requests",
"id": "43619000-0000-0000-0000591D", //{request_id} "
attributes": {
"callback_url": {callback_url},
"is_completed": false,
"message": null
}
}
}
Workflow run
Usually it takes a minute to run a pre-filled workflow. To check the workflow status, send a GET request to the /slate-creation-from-event-bot/create-slate/{request_id} endpoint.
{request_id} — unique workflow creation ID. Replace the {request_id} placeholder with the id attribute value of the create and pre-fill workflow response JSON.
Request example:
curl
--request GET \
--url ' https://bots.airslate.com/slate-creation-from-event-bot/create-slate/{request_id}' \
--header 'Authorization: {{authorization_token}}
Check the is_completed attribute of the response body:
false — workflow is not running
true — workflow is running.
Code examples
Below, you’ll find 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' => '{authorization_token}']]);
$createSlateUrl = '/slate-creation-from-event-bot/create-slate';
// send a request to create a pre-filled Slate
$body = ["data" => ["type" => "slate_creation_requests", "attributes" =>
["callback_url" => "https://{callback_url}"]], 'meta' => ['fields' => [['id'
=> {FIELD_ALIAS}, 'value' => 'value', ]]]];
$createSlateResponse = $client->post($createSlateUrl, ['json' => $body]);
// check the request status
$requestID = json_decode($createSlateResponse->getBody()
->getContents() , true) ['data']['id'];
$slateStatusResponse = $client->get($createSlateUrl . '/' . $requestID);
echo $slateStatusResponse->getBody()
->getContents();
You can also find the code in this article.
Node.js code
const https = require('https');
// send a request to create a pre-filled Slate
const slateCreateReq = https.request(
{
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();
// check the request status
const statusReq = https.request(
{
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();
You can also find the code in this article.






