Customize a workflow for sms using Campaign API

This is an example json payload for a workflow that sends a single sms message:

{
  "schemaVersion":1,
  "startNode":1,
  "nodes":[
    {
      "id":1,
      "type":"smsSend",
      "smsTemplateId":"7c8193e0-cbeb-11e8-bf73-39509286cb15"
    }
  ]
}

This is an example json payload for a workflow that randomly chooses between three different sms templates:

{
  "schemaVersion":1,
  "startNode":1,
  "nodes":[
    {
      "id":1,
      "type":"random",
      "children":[2,3,4]
    },
    {
      "id":2,
      "type":"smsSend",
      "smsTemplateId":"3d09ac70-c669-11e8-8c80-2d9288cb446b"
    },
    {
      "id":3,
      "type":"smsSend",
      "smsTemplateId":"1bf29ab0-c669-11e8-8c80-2d9288cb446b"
    },
    {
      "id":4,
      "type":"smsSend",
      "smsTemplateId":"80031900-c5d6-11e8-8c80-2d9288cb446b"
    }
  ]
}

This is an example workflow that will either send a message or not at random:

{
  "schemaVersion":1,
  "startNode":1,
  "nodes":[
    {
      "id":1,
      "type":"random",
      "children":[2,3]
    },
    {
      "id":2,
      "type":"smsSend",
      "smsTemplateId":"3d09ac70-c669-11e8-8c80-2d9288cb446b"
    },
    {
      "id":3,
      "type":"control"
    }
  ]
}

The outer wrapper for the workflow contains the schemaVersion of the workflow, the first node that will be used in the workflow, and a list of all the nodes that the workflow uses. At the time of this document schemaVersion 1 is the only supported schema version.

The startNode parameter specifies the id of the first node that will be executed in a workflow. This will typically be 1, but could potentially be any id that corresponds to an id in the list of nodes in the workflow.

The nodes parameter is an array of workflow node objects. Each node object has a required id field that needs to be unique within the workflow, a type that defines how the node operates, and an optional list of ids of the children of the node.

The supported node types are random, smsSend, and control.

A random node will randomly choose a child node that it will progress to in the workflow. It has no additional parameters that need to be supplied.

An smsSend node will send an sms to the contact. This node requires an smsTemplateId to be provided, which corresponds to the id of an sms template. The sms message will use one of the phone numbers in the number set. If the contact has already had a phone number associated with them in the campaign (by a prior node that uses a phone number), that number will be reused if possible.

A control node does nothing and terminates a workflow. This node cannot have children and specifying children will be ignored. This node is intended to allow for various branching nodes (random and other future planned nodes) to have a terminal end point that can be reported against.


Did this page help you?