Branch

Using Branch to find the best channel to contact your customers.

Branch works with The Enterprise Communications API and allows you to set rules to prioritise the order of channels in which a message to a customer can be sent. Branch works through these channels in priority order trying to find the best channel in order to send your message automatically.

Learn more in the Branch overview.


How to use Branch

To use Branch features you specify more than one channel to send to in your preference order, which can be done explicitly in the JSON or you can refer to a Branch rule set to allow easy tweaking of the rules without a code change later.

Learn more about Branch rule setup in the Branch channel setup guide.

Explicit rules

To use Branch with explicitly set channels, you must include more than one channel ID in the rules array in your message send, in the priority order required.

For example:

"rules": [
  "fbMessenger",
  "sms"
  ]
{
  "body": "Branch send from Comapi",
  "to": {
    "profileId": "[email protected]",
    "phoneNumber": "447123123123"
  },
  "rules": [
    "fbMessenger",
    "sms"
  ]
}

Configured rules

To use a reference to a Branch rule set, you must replace the usual rules section with a ruleSet property with the value set to the rule set ID you want to use.

For example:

"ruleSet": "Facebook-First"
{
  "body": "Branch send from Comapi",
  "to": {
    "profileId": "[email protected]",
    "phoneNumber": "447123123123"
  },
  "ruleSet": "Facebook-First"
}

🚧

Don't confuse Branch

You must specify either rules or a ruleSet section, but not both.