Skip to content

    Arabic or English · ↑↓ to move · Enter to open · Esc to close

    العربية
    On this page

    Auto-replies

    Create a rule

    POST/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.

    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
    }'
    Request — JSON
    {
      "name": "الأسعار",
      "trigger": {
        "type": "KEYWORD",
        "match": "CONTAINS",
        "keywords": [
          "سعر",
          "بكام",
          "price"
        ]
      },
      "reply": {
        "text": "أهلاً {name|بيك} 👋 الأسعار: https://example.com/prices"
      },
      "cooldownMinutes": 60
    }

    Response

    201Example

    201 — application/json
    {
      "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"
    }

    Fields in this response

    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"

    Parameters

    Path

    NameTypeConstraintsDescription
    numberIdrequiredTypestringConstraints—DescriptionNumber id (GET /v2/numbers).

    Headers

    NameTypeConstraintsDescription
    Idempotency-KeyoptionalTypestringConstraints≤ 191 charsDescriptionYour 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-IdoptionalTypestringConstraints—DescriptionOptional: your own request id, echoed back (otherwise we generate req_…). Quote it to support.

    Body

    NameTypeConstraintsDescription
    namerequiredTypestringConstraints≤ 120 charsDescriptionRule name (≤ 120).
    enabledoptionalTypebooleanConstraintsdefault trueDescriptionfalse keeps the rule but stops it from answering.
    triggerrequiredTypeobjectConstraints—DescriptionWhen the rule answers.
    trigger.typeoptionalTypestringConstraintsone of: KEYWORD · FIRST_MESSAGE · AWAYDescriptionKEYWORD (message contains / equals a keyword), FIRST_MESSAGE (welcome a new chat) or AWAY (outside the schedule).
    trigger.matchoptionalTypestringConstraintsone of: EXACT · CONTAINS · STARTS_WITH · REGEXDescriptionEXACT, 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.keywordsoptionalTypestring[]Constraints≤ 50 itemsDescriptionUp to 50 keywords for EXACT / CONTAINS / STARTS_WITH rules.
    trigger.patternsoptionalTypestring[]Constraints1–10 itemsDescriptionREGEX 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.regexoptionalTypeobjectConstraints—DescriptionREGEX options.
    trigger.regex.ignoreCaseoptionalTypebooleanConstraintsdefault trueDescriptionCase-insensitive matching (default true).
    trigger.regex.normalizeArabicoptionalTypebooleanConstraintsdefault trueDescriptionMatch the Arabic-normalised text: أ/إ/آ → ا, ى → ي, ة → ه, tatweel and diacritics removed, Arabic digits → 0–9 (default true).
    trigger.regex.allowLinksInCapturesoptionalTypebooleanConstraintsdefault falseDescriptionKeep 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).
    scheduleoptionalTypeobject | nullConstraints—DescriptionBusiness hours (for AWAY rules). null = always.
    schedule.timezoneoptionalTypestringConstraints—DescriptionIANA time zone, e.g. Africa/Cairo, Asia/Riyadh.
    schedule.daysoptionalTypeinteger[]Constraints—DescriptionWorking days, 0 = Sunday … 6 = Saturday.
    schedule.startoptionalTypestringConstraints—DescriptionOpening time HH:mm.
    schedule.endoptionalTypestringConstraints—DescriptionClosing time HH:mm.
    replyrequiredTypeobjectConstraints—DescriptionWhat to answer.
    reply.textoptionalTypestringConstraints≤ 4096 charsDescriptionReply text; {name|fallback} inserts the customer name.
    reply.mediaUrloptionalTypestringConstraints—DescriptionOptional public https:// file to send with the reply.
    reply.mediaTypeoptionalTypestringConstraintsone of: image · video · document · audioDescriptionType of reply.mediaUrl.
    cooldownMinutesoptionalTypeintegerConstraints≥ 0DescriptionDo not answer the same person with this rule again for this many minutes.
    priorityoptionalTypeintegerConstraints—DescriptionOrder when several rules match: the lowest number is checked first (default 0).

    Errors

    Besides the authentication, rate-limit and validation errors every endpoint can return:

    • 403 · AUTO_REPLIES_NOT_IN_PLAN — Your plan does not include auto-replies.

      Upgrade.

      Correct the cause before repeating the request.

      HTTP 403 · application/json
      {
        "error": {
          "code": "AUTO_REPLIES_NOT_IN_PLAN",
          "message": "Your plan does not include auto-replies.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#AUTO_REPLIES_NOT_IN_PLAN",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · AUTO_REPLY_KEYWORDS_REQUIRED — Keyword rules need keywords.

      Add trigger.keywords.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "AUTO_REPLY_KEYWORDS_REQUIRED",
          "message": "Keyword rules need keywords.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#AUTO_REPLY_KEYWORDS_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · AUTO_REPLY_PATTERNS_REQUIRED — Regular-expression rules need at least one pattern.

      Add trigger.patterns (1–10 patterns).

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "AUTO_REPLY_PATTERNS_REQUIRED",
          "message": "Regular-expression rules need at least one pattern.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#AUTO_REPLY_PATTERNS_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · AUTO_REPLY_REGEX_INVALID — A 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.

      details: patternIndex, reason, position (1-based) and messages {en, ar}. Fix that pattern; test it with POST /auto-replies/test.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "AUTO_REPLY_REGEX_INVALID",
          "message": "A 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.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#AUTO_REPLY_REGEX_INVALID",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · AUTO_REPLY_REGEX_TOO_MANY_PATTERNS — A rule can have at most 10 patterns.

      Combine alternatives with | or split the rule.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "AUTO_REPLY_REGEX_TOO_MANY_PATTERNS",
          "message": "A rule can have at most 10 patterns.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#AUTO_REPLY_REGEX_TOO_MANY_PATTERNS",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · AUTO_REPLY_REGEX_RULE_LIMIT — An account can have at most 50 regular-expression rules.

      Delete or merge REGEX rules (details.limit, details.used).

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "AUTO_REPLY_REGEX_RULE_LIMIT",
          "message": "An account can have at most 50 regular-expression rules.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#AUTO_REPLY_REGEX_RULE_LIMIT",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 503 · AUTO_REPLY_REGEX_ENGINE_UNAVAILABLE — Regular expressions are temporarily unavailable.

      Retry later; literal keyword rules keep working.

      Retry after addressing the cause.

      HTTP 503 · application/json
      {
        "error": {
          "code": "AUTO_REPLY_REGEX_ENGINE_UNAVAILABLE",
          "message": "Regular expressions are temporarily unavailable.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#AUTO_REPLY_REGEX_ENGINE_UNAVAILABLE",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · AUTO_REPLY_SCHEDULE_REQUIRED — Away rules need business hours.

      Add schedule.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "AUTO_REPLY_SCHEDULE_REQUIRED",
          "message": "Away rules need business hours.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#AUTO_REPLY_SCHEDULE_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · INVALID_SCHEDULE — Invalid schedule or time zone.

      Use HH:mm and an IANA time zone.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "INVALID_SCHEDULE",
          "message": "Invalid schedule or time zone.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#INVALID_SCHEDULE",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 404 · NUMBER_NOT_FOUND — Number not found in this account.

      Check numberId (GET /v2/numbers).

      Correct the cause before repeating the request.

      HTTP 404 · application/json
      {
        "error": {
          "code": "NUMBER_NOT_FOUND",
          "message": "Number not found in this account.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#NUMBER_NOT_FOUND",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 400 · IDEMPOTENCY_KEY_INVALID — Idempotency-Key must be 1–191 visible ASCII characters.

      Use e.g. order-1042-confirm.

      Correct the cause before repeating the request.

      HTTP 400 · application/json
      {
        "error": {
          "code": "IDEMPOTENCY_KEY_INVALID",
          "message": "Idempotency-Key must be 1–191 visible ASCII characters.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#IDEMPOTENCY_KEY_INVALID",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 409 · IDEMPOTENCY_KEY_REUSED — This Idempotency-Key was used with a different request.

      Use a new key for a new request.

      Correct the cause before repeating the request.

      HTTP 409 · application/json
      {
        "error": {
          "code": "IDEMPOTENCY_KEY_REUSED",
          "message": "This Idempotency-Key was used with a different request.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#IDEMPOTENCY_KEY_REUSED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 409 · IDEMPOTENCY_IN_PROGRESS — The first request with this key is still running.

      Retry in a few seconds.

      Retry after addressing the cause.

      HTTP 409 · application/json
      {
        "error": {
          "code": "IDEMPOTENCY_IN_PROGRESS",
          "message": "The first request with this key is still running.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#IDEMPOTENCY_IN_PROGRESS",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 403 · SCOPE_REQUIRED — The key lacks the scope of this endpoint.

      Add the scope in details.required to the key.

      Correct the cause before repeating the request.

      HTTP 403 · application/json
      {
        "error": {
          "code": "SCOPE_REQUIRED",
          "message": "The key lacks the scope of this endpoint.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#SCOPE_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 401 · API_KEY_REQUIRED — No API key was sent.

      Send Authorization: Bearer wsl_live_…

      Correct the cause before repeating the request.

      HTTP 401 · application/json
      {
        "error": {
          "code": "API_KEY_REQUIRED",
          "message": "No API key was sent.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#API_KEY_REQUIRED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 401 · API_KEY_INVALID — The API key is not valid.

      Copy the key again from Settings → API keys (it is shown only once; create a new one if lost).

      Correct the cause before repeating the request.

      HTTP 401 · application/json
      {
        "error": {
          "code": "API_KEY_INVALID",
          "message": "The API key is not valid.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#API_KEY_INVALID",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors
    • 429 · RATE_LIMITED — Rate limit of this key reached.

      Wait Retry-After seconds; watch X-RateLimit-Remaining.

      Retry after addressing the cause.

      HTTP 429 · application/json
      {
        "error": {
          "code": "RATE_LIMITED",
          "message": "Rate limit of this key reached.",
          "docsUrl": "https://mursilat.com/developers/v2/errors#RATE_LIMITED",
          "requestId": "req_6604bedc8c489f20e582691a"
        }
      }
      Errors

    Errors →

    Behaviour notes

    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 example

    Preview — this copy of the docs isn’t on mursilat.com, so the console shows the documented example instead of calling the API.

    Real requests use your real number and plan: they can send WhatsApp messages, spend quota and delete data. (changes settings)

    Kept only in this tab’s memory: never saved, never put in the URL, sent only to mursilat.com. Reloading the page forgets it.

    Path parameters

    Send this request for real?

    This changes your account settings.

    POST /v2/numbers/{numberId}/auto-replies