💬 Shared WhatsApp Inbox on the new PlatformMore
1msg official logo

Send a contact card via WhatsApp API (sendContact)

This scenario sends a WhatsApp contact card with sendContact during the 24-hour customer service window.

Use case overview

This scenario sends a WhatsApp contact card with sendContact during the 24-hour customer service window. The client receives the specialist name and phone without copying digits manually.

Template example

Please reach our specialist using the contact card below.

WhatsApp Business API for specialist handoff — share contact card

When to use it

Reach for this scenario when first-line support has approved escalation to a named specialist and the 24-hour customer service window is still open. It fits helpdesk workflows where a human expert must take over without losing chat context — especially when sharing a phone number as plain text would risk a wrong dial.

Fewer wrong-number calls
sendContact delivers the specialist display name and E.164 phone as a vCard in the active session, so the client taps to call instead of retyping digits from a plain-text message.
Contact saved in one tap
The card opens WhatsApp's native save flow, so the specialist name and number land in the client's phone book without manual entry.
Handoff stays in the same thread
The message goes out inside the open session after an agent marks the ticket ready for escalation, so the client never leaves the support chat to hunt for a number elsewhere.
No manual number sharing by agents
Your backend loads the specialist name and phone from the integration contract when escalation is approved, so front-line agents do not copy-paste or dictate digits.

Workflow

  1. Trigger

    An agent marks the ticket ready for specialist escalation.

    event · triggered

  2. Capture event

    Your backend loads the specialist display name and phone number.

    phone: "+…"

  3. Build & send

    sendContact delivers the contact card in the active session.

    POST /send_contact

  4. Delivered

    The client saves or calls the specialist from WhatsApp.

    delivered

WhatsApp Business API for specialist handoff — share contact card

Technical implementation

Prerequisites

  1. 1MSG API Key · How to get API Key
  2. WhatsApp Business account · How to Connect WABA
  3. Open 24-hour session window · How the 24-hour window works
  4. Customer opt-in · How to Manage Customers Consent
  5. Webhook endpoint · How to Set Up Webhooks

Code examples

#!/usr/bin/env bash
set -euo pipefail

# === Configuration (replace "___" placeholders) ===
API_BASE_URL="https://api.1msg.io"        # production 1MSG API base URL
CHANNEL_ID="___"                           # channel ID from 1MSG dashboard
API_TOKEN="___"                            # channel JWT token (Bearer)



# === Test data ===
TEST_PHONE="___"                 # client phone in international format

PHONE_NORM="$(printf '%s' "$TEST_PHONE" | tr -cd '0-9')"
URL="${API_BASE_URL%/}/${CHANNEL_ID}/sendContact"

# specialist display name (code_contract)
# specialist phone in E.164 format
read -r -d '' PAYLOAD <<JSON || true
{
  "phone": "${PHONE_NORM}",
  "contacts": [
    {
      "name": { "formatted_name": "Jane Specialist", "first_name": "Jane Specialist" },
      "phones": [{ "phone": "+12025550199", "type": "CELL" }]
    }
  ]
}
JSON

RESPONSE="$(curl -s -w '\n%{http_code}' -X POST "$URL" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${API_TOKEN}" \
  -d "$PAYLOAD")"

HTTP_CODE="$(printf '%s' "$RESPONSE" | tail -n1)"
BODY="$(printf '%s' "$RESPONSE" | sed '$d')"

case "$BODY" in
  *'"sent":true'*) ok=1 ;;
  *) ok=0 ;;
esac

if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ] && [ "$ok" -eq 1 ]; then
  echo "Message sent to client."
else
  echo "$BODY" >&2
  exit 1
fi

Response and delivery status

HTTP 2xx and JSON "sent": true mean 1MSG accepted the message for sending — not that it already reached the customer's phone. Save the id field (looks like wamid.…) to correlate delivery callbacks.

200 OKResponse
{
  "sent": true,
  "message": "Sent to [email protected]",
  "description": "Message has been sent to the provider",
  "id": "wamid.HBgLMzgwNjM5..."
}
  • sent

    Accepted for sending — not yet on the customer's phone

  • id

    Store it; delivery callbacks and hookInfo are keyed on this

Delivery statuses and webhooks →

Common errors

StatusAPI responseCauseFix
200Message was not sent: provide chatId, phone, bsuid, or usernameNo recipient the channel could resolve.Pass exactly one recipient: phone (country code plus number, digits only), chatId (for example [email protected]) or bsuid.
401token is requiredThe request has no token.Add your channel token as the token query parameter: https://api.1msg.io/{channelId}/{method}?token=…
429too many requests. please try laterThe channel is over its send rate.Queue messages on your side and retry with exponential backoff.

All error codes →

Common questions

Related

Build for WhatsApp in hours
without infrastructure hassle