Branch

Using Branch to find the best channel to contact your customer

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

To find out more see the Branch overview in the Get Started section.

How to use Branch

To use Branch features with a message send is very simple, you just 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 to the Branch rules without a code change later. To find out more about Branch rule set setup see the Branch channel setup guide.

Explicit Rules

To use Branch with explicitly set channels is very simple, simply 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 simply replace the usual rules section with a ruleSet property with it value set to the rule set id you want to use.

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

🚧

Don't confuse Branch

Ensure you specify either a rules or ruleSet section but not both!