Integrations
Channel groups

Channel groups

Combine channels of the same type into one destination for a channel step, and route each message with channel rules.

A channel group combines channels of the same type into a single destination for a channel step. The group's channel rules decide which of its channels send the message on each run, so one step can send to several providers. Use a channel group to:

  • Send through several providers at once. A push group holding APNs and FCM sends to iOS and Android devices from one push step.
  • Route by recipient. Send through a different SMS provider based on a recipient's country, or a different email channel for a given tenant.
  • Split traffic by percentage. Warm a sending domain or move a share of recipients to a new provider. See the sender domain migration tutorial for an example.
  • Easily switch providers. A group is a useful channel abstraction; switching later only means updating the group without having to change each workflow.

Create a channel group

#
Try it in the dashboard

Use the button above, or complete the following steps:

  1. Go to Channels and sources and click Create channel.
  2. Select the channel type, then select Target a group of channels.
  3. Enter a Name and a Key for the group. The key must be unique and can't be changed after you create the group.
  4. Click Create.

You can also ask the Knock agent to create or update a channel group, or manage groups with the Management API.

Channel rules

#

Channel rules are where a group's routing logic lives; they decide which channels will send a message.

Rule type

#

Start by specifying a rule type. This controls how many of its rules can send:

Rule typeCommon use caseBehavior
First match onlyEmail domain warming
Region distribution
Knock checks rules in order and sends through the first one that matches. Every rule except the last needs a condition.
Every matchPush notificationsKnock checks every rule and sends through each channel whose rule matches. One recipient may receive a message from each matching channel.

Channel conditions

#

Each rule describes a condition when a channel sends. Rule order only matters with First match only, where Knock stops at the first rule that matches. With Every match, Knock checks every rule regardless of order. A condition compares a property of the run, such as a recipient, actor, or tenant property or an environment variable, using the same operators as other conditions.

A random distribution condition routes a percentage of recipients to the channel instead. See random cohorts for how Knock assigns recipients.

Keep these limits in mind when you write rules:

  • A single provider will only send once. When several rules target the same channel and more than one of them match, Knock sends through that channel once, the same as if a single rule matched. For example, two different Resend rule matches will only produce one message send.
  • A failed send doesn't fall back to another channel. Rules decide which channels send before delivery, so if one channel fails, Knock doesn't try the next channel in the group.

Use a channel group in a workflow or broadcast

#

Select the group as the channel in a channel step of a workflow or broadcast. The group's Visibility setting controls whether it appears in the workflow builder, the broadcast builder, or both.

An email step whose Send from field is set to a channel group, showing the channels it targets

The group's page lists the workflows and unsent broadcasts that use it, across every environment.

Random cohorts

#

Random cohorts route recipients by percentage rather than by evaluating a property of the workflow run. Instead of making decisions based on who the recipient is, Knock assigns each recipient to a cohort and routes a percentage of them to a given channel. Splitting traffic this way enables you to shift volume to a new provider gradually rather than all at once. See our sender domain migration tutorial for guidance on how to use cohort routing to warm a new email sending domain.

Knock hashes the recipient ID against the channel group to assign the cohort, so a given recipient consistently routes to the same channel across workflow runs.

A single cohort rule only determines routing for the recipients inside that cohort, so it should be paired with at least one additional rule to catch remaining recipients. Set the channel group's operator to any so that messages are routed to only the first matching rule. To route the remaining recipients, create an always rule pointing at the fallback channel. The fallback rule must be the last rule in the group, after the cohort rule, so that only recipients not belonging to the cohort will reach it. With this configuration, Knock routes the cohort to the first channel and everyone else to the second.

Using more than one cohort

#

To route traffic across more than two channels, add a cohort rule for each one. Every cohort rule in a group hashes against the same channel group, so each recipient holds a single position that all of the group's cohort rules compare against. Percentages act as cumulative thresholds rather than independent shares: a rule routes the recipients below its percentage that the rules ahead of it didn't already take.

Order your cohort rules from the smallest percentage to the largest, and end the group with an always rule:

RuleargumentRecipients routed
Cohort rule pointing at channel A12The first 12%
Cohort rule pointing at channel B42The next 30%
always rule pointing at channel C—The remaining 58%

Set each percentage to the running total of the shares ahead of it. Channel B receives 30% of recipients because its rule is set to 42: the 12% already routed to channel A, plus its own 30%. Ordering a larger percentage ahead of a smaller one would prevent the smaller rule from ever matching, since every recipient below the smaller percentage is also below the larger one.

Delete a channel group

#

Delete a group from its page or from the options menu on its row in Channels and sources. Knock blocks the delete while any workflow or unsent broadcast uses the group:

  • In a workflow that isn't archived, including one whose status is Inactive.
  • In a broadcast that hasn't been sent yet, such as a draft or a scheduled broadcast.

While the group is in use, the delete fails. The Management API returns an error: "Channel group is referenced by active resources and cannot be archived." Knock checks both a workflow's saved changes and its published version, so remove the group from each step that targets it and commit or publish that change before you delete the group. Sent broadcasts and archived workflows don't block a delete.

Channel groups are account-wide, so a delete removes the group from every environment at once. If you've enabled environments, Knock checks workflows and broadcasts in every environment and branch.

Archiving a channel in a group

#

Knock blocks archiving a channel while a channel group includes it. To archive the channel, delete the group or update the group's rules to remove the channel, then archive the channel from Channels and sources.

Management API reference

#

Channel groups can be edited through the Management API.

New chat