•••
 
Documentation   /   Actions   /   Integration actions
 
 

Integration actions

 

Send a payload: payload

Sends an HTTP request to another system when the item is reached. It can save the response as the item's answer, so later items can use it.

Directive Required Description
---options Yes The URL. Must start with https://.
---method No POST (default), PUT or GET.
---content_type No form (form data, the default), formencoded (x-www-form-urlencoded), json or xml.
---pass_variables No The data to send. For form and formencoded, use {key}_IS_{value}_AND_.... For json and xml, write the body itself.
---custom_headers No Extra headers, as {Header-Name}_IS_{value}_AND_....
---save_output No true saves the response as the item's answer.
---look_at No For JSON responses: the path to the value you want, e.g. data:customer:id. Separate alternatives with [|].
---output_pattern No How to format the saved output, using {{variables}} from the response. If blank, the whole response is saved.
---look_at_fail, ---output_pattern_fail No The same, for error responses.
---hide_output No true saves the output without showing it in the task.
---can_refresh No true lets users resend the request with a button.

A response code beginning with 2 counts as success. Requests time out after 30 seconds.

Example: send JSON to another system

--#item:
---depends_on:offer_signed
---id:create_employee
---title:Create the employee record
---action:payload
---options:https://hr.example.com/api/employees
---method:POST
---content_type:json
---custom_headers:Authorization_IS_Bearer {{hr_api_token}}
---pass_variables:{"name":"{{candidate_name}}","email":"{{candidate_email}}","start":"{{start_date}}"}
---save_output:true
---look_at:data:id
---output_pattern:Employee ID {{id}}
---hide_output:true

Example: start a task in another workflow

--#item:
---id:start_onboarding
---action:payload
---options:https://plainly.com/start
---method:POST
---content_type:formencoded
---pass_variables:key_IS_{onboarding_workflow_api_key}_AND_no_redirect_IS_1_AND_name_IS_{{candidate_name}}_AND_candidate_email_IS_{{candidate_email}}
---save_output:true
---look_at:data:detail
Important

Keep API tokens out of workflow code where you can. Anyone who can edit the workflow can read its code.

Receive a payload: hook

Waits for another system to send in a value. The task shows the item as waiting until the value arrives. Then the value becomes the item's answer, and filters and outcomes work as usual.

Directive Required Description
---string_format No The format the incoming value must have. See String formats.
--#item:
---id:dbs_result
---title:Waiting for the DBS check result
---action:hook
---string_format:equals=clear|Result must be clear
---outcome:dbs_done

The other system sends the value to https://plainly.com/hook. See API: Doing task actions. That endpoint can also complete question, text_input, attachment and hidden items.