Skip integrations
Privileged users can skip integrations on a per-message basis, providing greater control and flexibility when publishing messages to a channel. Skipping integration helps avoid infinite loops, for example, when an integration republishes a message to the same channel, potentially triggering itself again.
A strong use case for skipping integrations is in chat applications. For example, a moderation service publishes a command telling clients to edit or delete a message. That command should not trigger further moderation events by itself.
Skip all integrations
To skip all integration rules for a specific message, set the skipRule
field to '*'
in the privileged
section of the message extras
.
The following example shows how to skip all integration rules when publishing a message to a channel:
const rest = new Ably.Rest('<loading API key, please wait>');
const channel = rest.channels.get('dug-odd-jug');
await channel.publish({
name: 'event_name',
data: 'event_data',
extras: {
privileged: {
skipRule: '*'
}
}
});
Demo OnlyCopyCopied!
You can also skip specific integration rules by including their ruleId in an array passed to skipRule. Rule IDs can be found in the Integrations tab of your Ably dashboard, via the Control API, or in the message envelope.
The following example shows how to skip specific integration rules when publishing a message to a channel:
const rest = new Ably.Rest('<loading API key, please wait>');
const channel = rest.channels.get('dug-odd-jug');
await channel.publish({
name: 'event_name',
data: 'event_data',
extras: {
privileged: { skipRule: ['rule_id_1'] }
}
})
Demo OnlyCopyCopied!