Skip to main content

“Start from external event” trigger start

Y
Written by Yuliia Biletska
Updated over 2 months ago

This bot is available for free, and its usage does not consume credits. For more information about credit usage, refer to this article.

The Start from external event endpoint allows to execute documents in workflows automatically through a POST request from external services. This integration ensures smooth communication between systems, enabling workflows to execute in your workspace without any manual input. You can use this endpoint to send document invitations and pre-fill your workflows with data.

Setup

Once the desired workflow is published, go to the Workflow page and select Start from external event in the three dots menu.

Toggle the Start from external event button to On.

Configure the external service

To enable the feature, configure an external service to send a POST request to the airSlate WorkFlow endpoint. Below are the essential components:


POST Request URL

The POST request is sent to a specific URL that is unique to each workspace. This URL is generated by airSlate WorkFlow automatically when you select the Start from external event trigger.

Copy the URL and paste it into the POST command in Postman or any other console of your choice.

Authorization Token

To secure the communication between the external service and airSlate WorkFlow, an authorization token is required. This token ensures that only authorized services can trigger the workflow.

Note: Keep this token secure and do not share it publicly, as it grants the ability to start the workflow. The token can be refreshed at any time, but ensure you adjust the settings accordingly if you do so.

1.Go the Headers tab.

2.Click at new row in Key column and type Authorization

3.Paste the token copied to the respective cell in Value column

4.All set!

Request Body

The request body contains data that will be sent to the workflow. The structure may vary depending on whether the signer is predefined or if the workflow includes parameters. If parameters are used, they allow you to customize how data flows into your workflow. Learn more about parameters in this article.

For workflows where the signer isn’t defined, you can use the following request body:

{

"callback_url": " https://callback.url ",

"parameters": [

{

"type": "recipient_parameter_value",

"id": "Fill and sign 1",

"attributes": {

"alias": "Fill and sign 1",

"value": " [email protected] ",

"value_type": "RECIPIENT_EMAIL",

"skip_message": false,

"message": {

"text": "Hi {user_name},\n\nYou’re invited to fill out {flow_name}. This is test.",

"subject": "You're invited to complete the documents"

}

}

}

]

}

For workflows where the documents will be sent to the signers phone number use the following request body:

{
"callback_url": "https://callback.url",
"parameters": [
{
"type": "recipient_parameter_value",
"id": "Signer 1",
"attributes": {
"alias": "Signer 1",
"value": "signer_phone_number",
"value_type": "RECIPIENT_PHONE",
"skip_message": false,
"message": {
"text": "You're invited to complete a document. Follow the link to fill it out: {share_accounts.access.login-link}",
"subject": "You're invited to complete the documents"
}
}
}
]
}

The key fields are:

value: indicate the signer phone number without +;

{share_accounts.access.login-link} : this is a reference to the document which should be filled in by the signer. This placeholder should not be modified.

If the workflow includes other parameters the request body may look like this:

{

"callback_url": "https://callback.url",

"parameters": [

{

"type": "recipient_parameter_value",

"id": "Fill and sign 1",

"attributes": {

"alias": "Fill and sign 1",

"value": "[email protected]",

"value_type": "RECIPIENT_EMAIL",

"skip_message": false,

"message": {

"text": "Hi {user_name}\nYou're invited to fill out a document in the {flow_name} Workflows.",

"subject": "You're invited to complete the documents"

}

}

},

{

"type": "parameter_value",

"id": "Manager's name",

"attributes": {

"alias": "Manager's name",

"value": ""

}

},

{

"type": "parameter_value",

"id": "Department",

"attributes": {

"alias": "Department",

"value": ""

}

}

]

}

The key fields are:

type: defines the type of request, typically "recipient_parameter_value" or "parameter_value"

id: specifies the workflow element or workflow parameter to which the data applies

attributes: Contains the actual data that will be inserted into the workflow fields. This includes:

  • alias: a descriptive name automatically set by the system based on workflow settings. It serves as a reference label for each parameter, helping clarify the role of the data within the request. In the example above, the alias " Manager's name" is set automatically based on the workflow settings, making it clear that the value which should be entered.

  • value: the actual data to be entered.

  • value_type: defines the type of value being sent. You need to use either " RECIPIENT_EMAIL" or " RECIPIENT_PHONE" for this parameter.

  • Skip_message: determines whether an invitation is sent. If set to False, an email or text message with the invitation link will be sent. If set to True, no invitation link is sent, but the step will still be assigned for document completion. You can fully customize this message for emails, including the subject and body text, and personalize it using placeholders (e.g., {recipient_name}, {workflow_name}).

1.Go the Body tab;

2.Select the raw as a data type and paste the request body;

3. Click Send.

Signers from contacts, group, document field

If the signer is chosen from your contacts, groups, or from a document field within the workflow, the request body will not include email addresses. Here's an example:

{

"callback_url": " https://callback.url"

}

If the workflow includes other parameters the request body may look like this:

{

"callback_url": "https://callback.url",

"parameters": [

{

"type": "parameter_value",

"id": "Manager's name",

"attributes": {

"alias": "Manager's name",

"value": ""

}

},

{

"type": "parameter_value",

"id": "Department",

"attributes": {

"alias": "Department",

"value": ""

}

}

]

}

Note:If an input parameter is optional based on the workflow setup and you do not plan to pass a value for it, remove the entire clause for that parameter from the request body.
Learn more about workflow parameters in this article.

Status code of the response:

201 — the request to execute workflow 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.

400 — the usage of Start from external event is disabled for the workflow due to free credits overuse or an admin switched on the possibility

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.

422 — Input parameter does not have a value or signer's email or phone number is in incorrect format.

Workflow execution

Usually it takes a minute to execute the workflow. To check the workflow status, send a GET request:

GET https://{workspace}.airslate-stage.xyz/api/v1/flows/run/{id}

Authorization: {authorization_token}

Where:

{workspace} - the name of your workspace. It is indicated in the POST request.

{id} - flow id which can be found in the response.

{authorization_token} - the token can be found in the trigger settings.

Response example:

{

"data": {

"type": "flow_external_start_requests",

"id": "CD147000-0000-0000-000034B0",

"attributes": {

"flow_id": "D3280A82-18D0-76C3-0000BA29",

"template_revision_id": "09F724DC-8400-0000-000049B7",

"packet_id": "DC0177D3-BB00-0000-0000C9C1",

"status": "success",

"fail_reason": null,

"callback_url": null,

"callback_status": "init"

}

}

}

Once the setup is completed, close the setup menu.

Start automatically from Airtable


Execute workflows pre-filling documents from Airtable fields with a button in Airtable. For this, you need to:

  • Configure the Pre-fill fields from Airtable bot

  • Enable the trigger start

  • Set up the scripting addon in Airtable.

Here are the detailed guidelines:

Set up the Pre-fill fields from Airtable bot

Follow the steps below to set up the bot. For more detailed guidelines, feel free to address the Pre-fill fields from the Airtable bot article.


1. In the step settings, select Add bot or click the plus icon after a specific action. Choose Bot and search for the Pre-fill fields from Airtable bot. Click on the bot to install it.

2. In Trigger, select when you want the document to be pre-filled:

  • Step started

  • Document opened (recommended option when configuring automatic start from Airtable)

  • Field changed

  • Document completed

3.To connect the bot to your Airtable account, select Connect in the Source section.


In the new window, grant access to your Airtable workspace and its bases.

Once done, you will see a successful connection via Airtable Auth.

Select the Airtable base, table, view you would like to work with and click Continue.

4. In Find record, select a lookup type from the dropdown. In our case, it must be Record ID.

Click Continue to proceed.


5. In Data mapping, connect your record fields to document fields by clicking Map fields. The data from connected Airtable fields will be pre-filled into the documents.

The Drag data to document fields modal window will open. Drag and drop the record field onto the document field.

6. In the Test section, click Test to check how the bot works. If everything is set up correctly, you will see a success message. If there are any issues, an error message will appear.

In our case, we have to provide an Airtable record ID. To get the record ID, go to your Airtable organization and find the record you need. Hover over the record and click on the Expand icon.

The record will open, and you’ll find the record ID in the address bar. It starts with ‘rec’ and finishes before the question mark.

Copy it and paste it in the Test field.

Once the bot setup is finished, ensure you have selected one of the following options as a signer/recipient for the step in question:

  • Contact

  • Group

  • Signer from the document field.

Once the workflow setup is finished, Publish the workflow.

Note: If the workflow is not published, the automatic start won’t work.

Enable start from the external service for the workflow

1. In your published workflow, click on the tree-dots menu and select Start from external event.

2. Move the toggle to activate the start. In the sidebar, you’ll find the authorization token that will need to configure the Airtable button.

Configure button in Airtable

1. Go to Airtable and add the button field to the table from which you want to start the workflow. Learn more about button fields in the Airtable documentation.

2. In the Action field of the button settings, select Run script.

Note: To proceed with setup, you need a scripting extension installed. This extension is available only with paid Airtable plans. Learn more about scripting extensions in the Airtable documentation.

Next, do the following steps:

  1. Select the dashboard for which you need to run the script

  2. In the Extension, select the scripting extension you've installed

  3. Click Create field once ready.

3. In the extension console, click Edit code and paste the following script:

let table = base.getTable("TABLE_NAME");

let record = await input.recordAsync("Select a record", table);

let rowsData = {

"additional_data": {

"record_id": record.id

}

}

let token = "TOKEN_FROM_AIRSLATE"

let airslateApiUrl = "https://api.airslate.com/v1/flows/run";

let response = await remoteFetchAsync(airslateApiUrl, {

method: 'POST',

headers: {

'Content-Type': 'application/json',

'Authorization': ${token},

},

body: JSON.stringify(rowsData)

});

// handle the response

if (response.ok) {

console.log(response.status);

//let jsonResponse = await response.json();

//output.text(`Request sent successfully: ${JSON.stringify(jsonResponse)}`);

} else {

output.text(`Error sending request: ${response.statusText}`);

}

In the script, replace the following values:

TABLE_NAME - insert the name of the table for which you’re creating the button.

TOKEN_FROM_AIRSLATE - copy the authorization token from WorkFlow and paste it.

After that, click Publish script and Run the script.

The buttons will appear in the table. Now, everytime you click the button in Airtable, the workflow will execute creating the package and pre-filling documents with data from Airtable.


Did this answer your question?