Masheev Automations
Automations run server-side rules that react to events in Masheev. They consist of triggers, conditions, and actions.
Quick Start
import { apiClient } from "@masheev/client/server";
await apiClient.automations.create.mutate({
name: "Auto-assign VIP contacts",
trigger: "conversation.created",
conditions: [
{ field: "contact.customAttributes.plan", operator: "equals", value: "enterprise" },
],
actions: [
{ type: "set_priority", value: "high" },
{ type: "assign_to", assigneeType: "agent", assigneeId: "agt_..." },
{ type: "add_label", labelId: "label_vip" },
],
});
Triggers
| Trigger |
When |
conversation.created |
New conversation starts |
conversation.updated |
Conversation status/priority/assignment changes |
conversation.assigned |
Conversation assigned to agent/AI |
message.created |
New message in any conversation |
sla.warning |
SLA warning threshold reached |
sla.breach |
SLA breached |
time.schedule |
Cron-based scheduled trigger |
Conditions
| Operator |
Description |
Example |
equals |
Exact match |
channel equals "whatsapp" |
not_equals |
Not equal |
status not_equals "resolved" |
contains |
String contains |
content contains "urgent" |
matches |
Regex match |
email matches "@enterprise.com$" |
greater_than |
Numeric comparison |
messageCount greater_than 10 |
less_than |
Numeric comparison |
priority less_than "high" |
is_set |
Field has a value |
assigneeId is_set |
Actions
| Action |
Description |
set_status |
Change conversation status (open, pending, resolved) |
set_priority |
Set priority (low, medium, high, urgent) |
assign_to |
Assign to agent, AI, or unassign |
add_label / remove_label |
Tag management |
send_canned_response |
Send a pre-written message |
send_template |
Send a channel template (WhatsApp, email) |
add_note |
Add internal note |
snooze |
Snooze conversation for a duration |
trigger_ai |
Hand to AI agent |
stop_ai |
Take back from AI |
webhook |
Call external URL (GET/POST with headers/payload) |
notify |
Send notification (email, Slack, in-app) |
Managing Automations
// List
const rules = await apiClient.automations.list.query({});
// Activate/deactivate
await apiClient.automations.activate.mutate({ id: "rule_...", active: false });
// View execution history
const runs = await apiClient.automations.listRuns.query({ automationId: "rule_..." });
// Pre-built templates
const templates = await apiClient.automations.listTemplates.query();
Workflow Builder
For complex multi-step automations, use the workflow builder (see masheev-workflows skill for client-side workflows). Server-side workflows support:
- AI invoke steps — Generate text/objects with tools
- Action steps — Execute platform skills
- Conditional steps — Branch based on conversation state
- Delay steps — Wait before next action
See references/templates.md for pre-built automation templates.
1---2name: masheev-automations3description: Use when building automation rules and workflows in Masheev. Covers triggers (conversation.created, message.created, SLA breach, time-based), conditions (equals, contains, greater_than), and actions (set status, assign, add labels, send responses, trigger AI, webhook calls, notifications). Also covers the workflow builder with AI invoke steps, action steps, conditional steps, and delay steps. Use this skill when someone asks to "automate conversations", "set up rules", "auto-assign", "auto-resolve", "trigger AI", or "build a workflow" in Masheev.4license: Apache-2.05---67# Masheev Automations89Automations run server-side rules that react to events in Masheev. They consist of triggers, conditions, and actions.1011## Quick Start1213```typescript14import { apiClient } from "@masheev/client/server";1516await apiClient.automations.create.mutate({17 name: "Auto-assign VIP contacts",18 trigger: "conversation.created",19 conditions: [20 { field: "contact.customAttributes.plan", operator: "equals", value: "enterprise" },21 ],22 actions: [23 { type: "set_priority", value: "high" },24 { type: "assign_to", assigneeType: "agent", assigneeId: "agt_..." },25 { type: "add_label", labelId: "label_vip" },26 ],27});28```2930## Triggers3132| Trigger | When |33|---------|------|34| `conversation.created` | New conversation starts |35| `conversation.updated` | Conversation status/priority/assignment changes |36| `conversation.assigned` | Conversation assigned to agent/AI |37| `message.created` | New message in any conversation |38| `sla.warning` | SLA warning threshold reached |39| `sla.breach` | SLA breached |40| `time.schedule` | Cron-based scheduled trigger |4142## Conditions4344| Operator | Description | Example |45|----------|-------------|---------|46| `equals` | Exact match | `channel equals "whatsapp"` |47| `not_equals` | Not equal | `status not_equals "resolved"` |48| `contains` | String contains | `content contains "urgent"` |49| `matches` | Regex match | `email matches "@enterprise.com$"` |50| `greater_than` | Numeric comparison | `messageCount greater_than 10` |51| `less_than` | Numeric comparison | `priority less_than "high"` |52| `is_set` | Field has a value | `assigneeId is_set` |5354## Actions5556| Action | Description |57|--------|-------------|58| `set_status` | Change conversation status (open, pending, resolved) |59| `set_priority` | Set priority (low, medium, high, urgent) |60| `assign_to` | Assign to agent, AI, or unassign |61| `add_label` / `remove_label` | Tag management |62| `send_canned_response` | Send a pre-written message |63| `send_template` | Send a channel template (WhatsApp, email) |64| `add_note` | Add internal note |65| `snooze` | Snooze conversation for a duration |66| `trigger_ai` | Hand to AI agent |67| `stop_ai` | Take back from AI |68| `webhook` | Call external URL (GET/POST with headers/payload) |69| `notify` | Send notification (email, Slack, in-app) |7071## Managing Automations7273```typescript74// List75const rules = await apiClient.automations.list.query({});7677// Activate/deactivate78await apiClient.automations.activate.mutate({ id: "rule_...", active: false });7980// View execution history81const runs = await apiClient.automations.listRuns.query({ automationId: "rule_..." });8283// Pre-built templates84const templates = await apiClient.automations.listTemplates.query();85```8687## Workflow Builder8889For complex multi-step automations, use the workflow builder (see masheev-workflows skill for client-side workflows). Server-side workflows support:9091- **AI invoke steps** — Generate text/objects with tools92- **Action steps** — Execute platform skills93- **Conditional steps** — Branch based on conversation state94- **Delay steps** — Wait before next action9596See [references/templates.md](./references/templates.md) for pre-built automation templates.