Skip to main content
POST
/
v2
/
_actions
Create WhatsApp Action
curl --request POST \
  --url https://prod-contactswing-fastapi-962560522883.us-central1.run.app/v2/_actions \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "type": "<string>",
  "is_active": true,
  "action_timing": "<string>",
  "phone_number": "<string>",
  "webhook": {
    "to": "<string>",
    "from": "<string>",
    "template_name": "<string>",
    "body_params": [
      "<string>"
    ],
    "header_params": [
      "<string>"
    ],
    "button_params": [
      "<string>"
    ],
    "language_code": "<string>",
    "mandatory": true
  }
}
'
{
  "ctx_id": "<string>",
  "data": {
    "action_id": "<string>",
    "name": "<string>",
    "type": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.contactswing.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
required
Enter your ContactSwing JWT Bearer token.

Request Body

name
string
required
Action display name. Example: My Whatsapp Action
description
string
required
Action purpose. Example: Send WhatsApp when user requests messaging
type
string
required
Action type: "SEND_WHATSAPP"
is_active
boolean
Enable/disable action
action_timing
string
required
When to trigger: "during"
phone_number
string
Override phone number (optional)
webhook
object
required
WhatsApp webhook configuration
to
string
required
Recipient WhatsApp number. Example: "12817126508"
from
string
required
Sender WhatsApp ID. Example: "650175178190170"
template_name
string
required
WhatsApp template name. Example: "call_permession_request"
body_params
string[]
Template body parameters []
header_params
string[]
Template header parameters []
button_params
string[]
Template button parameters []
language_code
string
Template language. Example: "en"
mandatory
boolean
Require WhatsApp response before proceeding

Response

201 Created - WhatsApp action created successfully
ctx_id
string
Request context ID
data
object
action_id
string
New WhatsApp action ID
name
string
Action name
type
string
”SEND_WHATSAPP”
400 Bad Request - Invalid WhatsApp template or numbers 401 Unauthorized - Invalid token