Recipe — Auto-tag conversations by message content
When an inbound message contains specific keywords, apply a tag automatically. The simplest pattern is a Returns tag for any message mentioning “refund” or “return.”
Auto-tagging is a foundation for downstream rules — once conversations are tagged consistently, you can route, escalate, and report on them.
What this rule does
- Trigger: A new inbound message arrives.
- Condition: Message body contains one of a list of keywords.
- Action: Add the corresponding tag.
Before you start
- The destination tag exists in Tag Management
Build it
- 1 — Trigger —
Message received - 2 — Condition —
message.direction equals inbound - 3 — Condition (AND) —
message.body contains refundORmessage.body contains return(use a nested OR group) - 4 — Branch —
Always - 5 — Action —
Add tag→ Returns
The nested OR is important: a single condition can only check one substring, so you build the OR inside an AND-with-direction group.
Why the inbound check matters
Without message.direction equals inbound, the rule would also fire on agent replies that contain “refund” — including the reply where the agent writes “Sure, we’ll process your refund.” That would re-tag a conversation that’s already been tagged, log a duplicate execution, and clutter reporting.
Variants
Multiple tags from multiple keyword groups
One rule per tag is the cleanest pattern, but if you want to keep them together, use branches:
- 1 —
body contains refund OR body contains return— Add tag Returns - 2 —
body contains shipping OR body contains delivery— Add tag Shipping - 3 —
body contains password OR body contains login— Add tag Auth
Branches evaluate top to bottom, and only the first matching If runs. To stamp every matching tag (not just the first), use Always branches instead.
Language-aware keywords
Keywords differ across languages. For multi-language teams, you have two options:
- One rule per language, gated on the conversation’s detected language.
- One rule with all keywords combined in one big OR group:
body contains refund OR body contains rückgabe OR body contains remboursement OR .... Simpler but less precise.
Negative tags
A condition like body contains "thank you" AND body not contains "but" lets you tag genuine positive feedback without sweeping in hedged complaints.
Verify it worked
Send a test inbound email that contains the keyword. Within a few seconds, the destination tag should be applied to the conversation. Send a second test reply as the agent with the same keyword — the rule should not re-fire (because of the inbound condition).
Troubleshooting
-
Symptom: Rule fires on every message, even those without the keyword. Fix: The OR group’s brackets are wrong, or an extra condition is missing. Re-check the condition tree.
-
Symptom: Rule re-tags the same conversation repeatedly. Fix: Add a condition
tags not contains <destination tag>so the rule skips already-tagged conversations. Or rely on the destination tag being idempotent —Add tagdoes not duplicate an existing tag. -
Symptom: False positives (“preform” matches because of “form”). Fix: Use word-boundary-aware keywords if available, or pick more specific phrases. Atender’s
containsis substring-match; it doesn’t recognize word boundaries.