Skip to content
API PlatformDevelopers

Recipes · R10

Opt-out sync (a customer replies STOP)

When a customer replies STOP, mark them in your CRM and tag the contact so nobody messages them again.

Goal: Opt-outs are respected everywhere, not just in one tool.

What starts it

Our webhook events

Subscribe to message.created; your receiver checks inbound texts for STOP.

Your values

Your https endpoint.

From the event (`data.contact.id`). (from the message.created/1 event)

Test mode (dry run): every step runs on your account, but nothing changes and nothing is sent.

  1. Step 1

    Receive messages

    POSTCreate an endpoint

    curl -X POST 'https://mcp.wa-api.cloud/v1/webhooks/endpoints' \
      -H "Authorization: Bearer $API_KEY" \
      -H 'Content-Type: application/json' \
      -H 'Idempotency-Key: opt-out-endpoint' \
      -d '{
      "url": "https://hooks.example.com/opt-out",
      "event_type_ids": [
        "message.created/1"
      ],
      "description": "Opt-out sync"
    }'

    Passes on: endpoint_id (from endpoint.id)

  2. Step 2

    Tag the contact as opted out

    POSTAdd tags to contacts

    curl -X POST 'https://mcp.wa-api.cloud/v1/contacts/tag' \
      -H "Authorization: Bearer $API_KEY" \
      -H 'Content-Type: application/json' \
      -d '{
      "contact_ids": [
        "48213"
      ],
      "tags": [
        "opted-out"
      ]
    }'

Good to know

  • Match STOP loosely (case, spaces, "stop please"), and in the languages your customers use.

Validated against the API spec on every build