1C Platform1cPlatform
Back to Documentation

Build complex multi-step workflows with conditional logic

Creating a Workflow

const workflow = await client.workflows.create({
  name: 'customer-onboarding',
  trigger: {
    type: 'webhook',
    event: 'user.created'
  },
  steps: [
    {
      id: 'send-welcome-email',
      type: 'email',
      template: 'welcome',
      to: '{{user.email}}'
    },
    {
      id: 'assign-agent',
      type: 'agent',
      agent_id: 'onboarding-agent',
      message: 'Help user get started'
    },
    {
      id: 'create-ticket',
      type: 'integration',
      service: 'zendesk',
      action: 'create_ticket'
    }
  ]
});

Conditional Logic

{
  id: 'check-plan',
  type: 'condition',
  if: '{{user.plan}} == "enterprise"',
  then: [
    {
      id: 'assign-success-manager',
      type: 'task'
    }
  ],
  else: [
    {
      id: 'send-self-serve-guide',
      type: 'email'
    }
  ]
}

Error Handling

Workflows automatically retry failed steps with exponential backoff. Configure retry behavior:

retry_policy: { max_attempts: 3, backoff: 'exponential' }