Zaptickdocs
Resource

Workflows

Multi-step automations — timers, branches, messages and webhooks stitched together.

#About

Workflows react to events (cart.abandoned, order.shipped, custom) or manual triggers, and run as long-lived state machines. Use them for abandoned cart, post- purchase nurture, and multi-touch retention sequences.

#Endpoints

  • GET/workflowsList workflows with their trigger + status.
  • POST/workflowsCreate a workflow from steps.
  • POST/workflows/triggerManually trigger a workflow for a contact (with payload).
GET/workflows

List workflows with their trigger + status.

SDK
TypeScript
const { workflows } = await zaptick.workflows.list({ status: 'active' });
POST/workflows

Create a workflow from steps.

SDK
TypeScript
await zaptick.workflows.create({
  name: 'Abandoned cart 2h',
  trigger: { type: 'event', event: 'cart.abandoned' },
  steps: [
    { type: 'wait', minutes: 120 },
    { type: 'send_template', templateName: 'cart_reminder_1h', variables: { '1': '{{cart.itemCount}}' } },
    { type: 'branch', condition: { field: 'cart.recovered', equals: true },
      then: [{ type: 'exit' }] },
    { type: 'wait', hours: 22 },
    { type: 'send_template', templateName: 'cart_discount_10', variables: {} },
  ],
});
POST/workflows/trigger

Manually trigger a workflow for a contact (with payload).

SDK
TypeScript
await zaptick.workflows.trigger({
  workflowId: 'wf_abandoned_cart',
  phone: '+919876543210',
  input: { cartId: 'CRT-42', total: 2499 },
});
Request body
JSON
{
  "workflowId": "wf_abandoned_cart",
  "phone": "+919876543210",
  "input": { "cartId": "CRT-42", "total": 2499 }
}
Response
JSON
{ "runId": "run_01J3..." }