Using events to trigger and control workflows
start_on
and cancel_on
.
start_on
to automatically start a workflow when specific events are received:
start_on
handler function can return:
start_data
field: Starts the workflow with the provided start dataNone
: Does not start the workflowcancel_on
to automatically cancel running workflows when specific events are received:
cancel_on
handler function should return:
True
: Cancel the workflow runFalse
: Keep the workflow runningstart_on
handlers:
cancel_on
handlers:
start_on
and cancel_on
handlerssample:
and can be used to trigger workflows automatically.
sample:email:*
pattern.
your_organization@start.onsample.com
), Sample automatically emits a sample:email:received
event.
Event Name: sample:email:received
Payload Structure:
sample:kno2:*
pattern when messages are received through your Kno2 integration.
sample:kno2:${connection.slug}:message-receive
event, where ${connection.slug}
corresponds to the specific Kno2 connection that received the message.
Event Name: sample:kno2:${connection.slug}:message-receive
Payload Structure:
message.id
: Unique identifier for the messagemessage.subject
: Subject line of the fax/messagemessage.toAddress
: Recipient fax numbermessage.fromAddress
: Sender fax numbermessage.sourceType
: Type of message (e.g., “Fax”)message.attachments
: Array of attachment metadata from Kno2attachments
: Array of Sample file metadata IDs for downloaded attachmentscancel_on
handler logicget_start_data()
returns expected structure