Auto-replies
Create a rule
/v2/numbers/{numberId}/auto-replies- Scope:
autoreplies:write - Idempotency-Key:optional
- changes settings
match: EXACT / CONTAINS / STARTS_WITH compare literal keywords after Arabic normalisation (أ/إ/آ, ى/ي, ة/ه, diacritics). REGEX takes trigger.patterns: RE2 regular expressions (linear time — no catastrophic backtracking). "regex" / "starts_with" in lower case and trigger.matchType are accepted.
Parameters
Path
| Name | Type | Constraints | Description |
|---|---|---|---|
numberIdrequired | Typestring | Constraints— | DescriptionNumber id (GET /v2/numbers). |
Headers
| Name | Type | Constraints | Description |
|---|---|---|---|
Idempotency-Keyoptional | Typestring | Constraints≤ 191 chars | DescriptionYour unique id for this operation (≤ 191 visible ASCII). A retry with the same key and body returns the first answer with Idempotent-Replayed: true — it never runs twice. Kept 24 h. |
X-Request-Idoptional | Typestring | Constraints— | DescriptionOptional: your own request id, echoed back (otherwise we generate req_…). Quote it to support. |
Body
| Name | Type | Constraints | Description |
|---|---|---|---|
namerequired | Typestring | Constraints≤ 120 chars | DescriptionRule name (≤ 120). |
enabledoptional | Typeboolean | Constraintsdefault true | Descriptionfalse keeps the rule but stops it from answering. |
triggerrequired | Typeobject | Constraints— | DescriptionWhen the rule answers. |
trigger.typeoptional | Typestring | Constraintsone of: KEYWORD · FIRST_MESSAGE · AWAY | DescriptionKEYWORD (message contains / equals a keyword), FIRST_MESSAGE (welcome a new chat) or AWAY (outside the schedule). |
trigger.matchoptional | Typestring | Constraintsone of: EXACT · CONTAINS · STARTS_WITH · REGEX | DescriptionEXACT, CONTAINS, STARTS_WITH (literal keywords after Arabic normalisation: أ/إ/آ → ا, ى → ي, ة → ه, diacritics removed) or REGEX (RE2 patterns in trigger.patterns). Any case is accepted (regex, starts_with); trigger.matchType is an alias. |
trigger.keywordsoptional | Typestring[] | Constraints≤ 50 items | DescriptionUp to 50 keywords for EXACT / CONTAINS / STARTS_WITH rules. |
trigger.patternsoptional | Typestring[] | Constraints1–10 items | DescriptionREGEX rules: 1–10 RE2 patterns, ≤ 200 characters each; any match fires the rule. Linear time — no lookarounds or backreferences. Captures go into the reply as {1}, {2} or {groupName}. |
trigger.regexoptional | Typeobject | Constraints— | DescriptionREGEX options. |
trigger.regex.ignoreCaseoptional | Typeboolean | Constraintsdefault true | DescriptionCase-insensitive matching (default true). |
trigger.regex.normalizeArabicoptional | Typeboolean | Constraintsdefault true | DescriptionMatch the Arabic-normalised text: أ/إ/آ → ا, ى → ي, ة → ه, tatweel and diacritics removed, Arabic digits → 0–9 (default true). |
trigger.regex.allowLinksInCapturesoptional | Typeboolean | Constraintsdefault false | DescriptionKeep link-like captures (URLs, domains, wa.me / t.me) in the reply (default false: always removed, so a customer can’t make your number send a link of their choice). |
scheduleoptional | Typeobject | null | Constraints— | DescriptionBusiness hours (for AWAY rules). null = always. |
schedule.timezoneoptional | Typestring | Constraints— | DescriptionIANA time zone, e.g. Africa/Cairo, Asia/Riyadh. |
schedule.daysoptional | Typeinteger[] | Constraints— | DescriptionWorking days, 0 = Sunday … 6 = Saturday. |
schedule.startoptional | Typestring | Constraints— | DescriptionOpening time HH:mm. |
schedule.endoptional | Typestring | Constraints— | DescriptionClosing time HH:mm. |
replyrequired | Typeobject | Constraints— | DescriptionWhat to answer. |
reply.textoptional | Typestring | Constraints≤ 4096 chars | DescriptionReply text; {name|fallback} inserts the customer name. |
reply.mediaUrloptional | Typestring | Constraints— | DescriptionOptional public https:// file to send with the reply. |
reply.mediaTypeoptional | Typestring | Constraintsone of: image · video · document · audio | DescriptionType of reply.mediaUrl. |
cooldownMinutesoptional | Typeinteger | Constraints≥ 0 | DescriptionDo not answer the same person with this rule again for this many minutes. |
priorityoptional | Typeinteger | Constraints— | DescriptionOrder when several rules match: the lowest number is checked first (default 0). |
Request
curl -X POST "https://mursilat.com/api/v2/numbers/cm1abcd2345efgh6789ijkl/auto-replies" \
-H "Authorization: Bearer $WASLA_API_KEY" \
-H "Idempotency-Key: order-1042-confirm" \
-H "Content-Type: application/json" \
-d '{
"name": "الأسعار",
"trigger": {
"type": "KEYWORD",
"match": "CONTAINS",
"keywords": [
"سعر",
"بكام",
"price"
]
},
"reply": {
"text": "أهلاً {name|بيك} 👋 الأسعار: https://example.com/prices"
},
"cooldownMinutes": 60
}'const res = await fetch('https://mursilat.com/api/v2/numbers/cm1abcd2345efgh6789ijkl/auto-replies', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.WASLA_API_KEY}`,
'Idempotency-Key': 'order-1042-confirm',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "الأسعار",
"trigger": {
"type": "KEYWORD",
"match": "CONTAINS",
"keywords": [
"سعر",
"بكام",
"price"
]
},
"reply": {
"text": "أهلاً {name|بيك} 👋 الأسعار: https://example.com/prices"
},
"cooldownMinutes": 60
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
console.log(data);import os
import requests
headers = {"Authorization": f"Bearer {os.environ['WASLA_API_KEY']}", "Idempotency-Key": "order-1042-confirm"}
res = requests.post(
"https://mursilat.com/api/v2/numbers/cm1abcd2345efgh6789ijkl/auto-replies",
headers=headers,
json={
"name": "الأسعار",
"trigger": {
"type": "KEYWORD",
"match": "CONTAINS",
"keywords": [
"سعر",
"بكام",
"price"
]
},
"reply": {
"text": "أهلاً {name|بيك} 👋 الأسعار: https://example.com/prices"
},
"cooldownMinutes": 60
},
timeout=30,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")
print(data)<?php
$ch = curl_init('https://mursilat.com/api/v2/numbers/cm1abcd2345efgh6789ijkl/auto-replies');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('WASLA_API_KEY'),
'Idempotency-Key: order-1042-confirm',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'الأسعار',
'trigger' => [
'type' => 'KEYWORD',
'match' => 'CONTAINS',
'keywords' => [
'سعر',
'بكام',
'price'
]
],
'reply' => [
'text' => 'أهلاً {name|بيك} 👋 الأسعار: https://example.com/prices'
],
'cooldownMinutes' => 60
], JSON_UNESCAPED_UNICODE),
]);
$data = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) { throw new Exception($data['error']['code'] . ': ' . $data['error']['message']); }
print_r($data);{
"name": "الأسعار",
"trigger": {
"type": "KEYWORD",
"match": "CONTAINS",
"keywords": [
"سعر",
"بكام",
"price"
]
},
"reply": {
"text": "أهلاً {name|بيك} 👋 الأسعار: https://example.com/prices"
},
"cooldownMinutes": 60
}Response
201Example
{
"id": "cm3rule0001xyz",
"sessionId": "cm1abcd2345efgh6789ijkl",
"scope": "number",
"name": "الأسعار",
"enabled": true,
"trigger": {
"type": "KEYWORD",
"match": "CONTAINS",
"keywords": [
"سعر",
"بكام",
"price"
]
},
"schedule": null,
"reply": {
"text": "أهلاً {name|بيك} 👋 الأسعار: https://example.com/prices"
},
"cooldownMinutes": 60,
"priority": 0,
"stats": {
"triggered": 42,
"lastTriggeredAt": "2026-10-13T07:40:00.000Z"
},
"createdAt": "2026-10-01T09:00:00.000Z",
"updatedAt": "2026-10-10T09:00:00.000Z"
}Response schema
Fields of the example answer. Expand objects and arrays.
responseobject13 fields
- idstring "cm3rule0001xyz"
- sessionIdstring "cm1abcd2345efgh6789ijkl"
- scopestring "number"
- namestring "الأسعار"
- enabledboolean true
triggerobject3 fields
- typestring "KEYWORD"
- matchstring "CONTAINS"
keywordsarray3 items
- [0]string "سعر"
- schedulenull null
replyobject1 fields
- textstring "أهلاً {name|بيك} 👋 الأسعار: https://example.com/prices"
- cooldownMinutesinteger 60
- priorityinteger 0
statsobject2 fields
- triggeredinteger 42
- lastTriggeredAtstring "2026-10-13T07:40:00.000Z"
- createdAtstring "2026-10-01T09:00:00.000Z"
- updatedAtstring "2026-10-10T09:00:00.000Z"
Errors
Besides the authentication, rate-limit and validation errors every endpoint can return:
- 403AUTO_REPLIES_NOT_IN_PLANYour plan does not include auto-replies.
- 400AUTO_REPLY_KEYWORDS_REQUIREDKeyword rules need keywords.
- 400AUTO_REPLY_PATTERNS_REQUIREDRegular-expression rules need at least one pattern.
- 400AUTO_REPLY_REGEX_INVALIDA pattern is not a valid RE2 regular expression, uses a feature RE2 does not support (lookarounds, backreferences, atomic / possessive), contains non-ASCII digits, tashkeel / tatweel or invisible characters, exceeds the limits (200 chars, {n} ≤ 100, complexity) or matches an empty message.
- 400AUTO_REPLY_REGEX_TOO_MANY_PATTERNSA rule can have at most 10 patterns.
- 400AUTO_REPLY_REGEX_RULE_LIMITAn account can have at most 50 regular-expression rules.
- 503AUTO_REPLY_REGEX_ENGINE_UNAVAILABLERegular expressions are temporarily unavailable.
- 400AUTO_REPLY_SCHEDULE_REQUIREDAway rules need business hours.
- 400INVALID_SCHEDULEInvalid schedule or time zone.
Number Shield & behaviour
REGEX example: {"name":"Order status","trigger":{"type":"KEYWORD","match":"regex","patterns":["(?:طلب|order)\s*#?(?<order>\d{4,8})"]},"reply":{"text":"طلبك رقم {order} بيتجهز 👍"}}. Captures go into the reply as {1}, {2} or {groupName} (escaped, ≤ 100 chars each, ≤ 1,024 chars added in total; link-like captures — URLs, domains, wa.me / t.me — are always removed unless regex.allowLinksInCaptures is true).
Limits: ≤ 10 patterns per rule, ≤ 200 characters each, {n} ≤ 100, ≤ 20 groups, ≤ 50 REGEX rules per account. Not supported by RE2: lookarounds (?=…) (?<=…), backreferences \1, atomic / possessive. Patterns use the digits 0–9 only, without tashkeel, tatweel or invisible characters. regex.ignoreCase and regex.normalizeArabic default to true. Messages longer than 4,096 characters are not checked against REGEX rules.
Order: lower priority number first, then keyword > welcome > away; at the same priority REGEX rules are evaluated after EXACT / CONTAINS / STARTS_WITH rules.
Try it
Send this request from your browser to the Mursilat API.
documented examplePreview — this copy of the docs isn’t on mursilat.com, so the console shows the documented example instead of calling the API.
Kept only in this tab’s memory: never saved, never put in the URL, sent only to mursilat.com. Reloading the page forgets it.