Skip to content
API PlatformDevelopers

Recipes · R2

Website lead form → contact, tag, welcome message, assign

A visitor fills in your website form; they become a tagged contact, get a welcome message, and the conversation lands with a sales rep.

Goal: Every lead is followed up in minutes, by a named person.

What starts it

Your own code or webhook

Your form handler (or Zapier, Typeform, Webflow…) calls your code with the form fields.

Your values

The phone number from the form.

The name from the form.

An approved welcome template with one body variable (the name).

The staff member who gets new leads.

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

  1. Step 1

    Create the contact

    POSTCreate or update a contact

    curl -X POST 'https://mcp.wa-api.cloud/v1/contacts' \
      -H "Authorization: Bearer $API_KEY" \
      -H 'Content-Type: application/json' \
      -H 'Idempotency-Key: lead-+15555550124-contact' \
      -d '{
      "phone": "+15555550124",
      "name": "Sam Lee"
    }'

    Passes on: contact_id (from id)

  2. Step 2

    Tag it as a website lead

    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": [
        "{{steps.contact.contact_id}}"
      ],
      "tags": [
        "website-lead"
      ]
    }'
  3. Step 3

    Send the welcome template

    POSTSend a WhatsApp template

    curl -X POST 'https://mcp.wa-api.cloud/v1/messages/template' \
      -H "Authorization: Bearer $API_KEY" \
      -H 'Content-Type: application/json' \
      -H 'Idempotency-Key: lead-+15555550124-welcome' \
      -d '{
      "contact_id": "{{steps.contact.contact_id}}",
      "template_id": "9121",
      "body_variables": [
        "Sam Lee"
      ]
    }'

    Passes on: conversation_id (from conversation_id)

  4. Step 4

    Give the conversation to a sales rep

    PUTAssign a conversation

    `only_if_unassigned` keeps a rep who already picked it up.

    curl -X PUT 'https://mcp.wa-api.cloud/v1/conversations/%7B%7Bsteps.welcome.conversation_id%7D%7D/assignment' \
      -H "Authorization: Bearer $API_KEY" \
      -H 'Content-Type: application/json' \
      -d '{
      "staff_id": "1203",
      "only_if_unassigned": true
    }'

Validated against the API spec on every build