POST
/api/whatsapp-sessions
Creates a new WhatsApp session with the provided details. Requires an active subscription and is subject to session limits.
Create WhatsApp Session
Creates a new WhatsApp session with the provided details. Requires an active subscription and is subject to session limits.
This endpoint requires an access token to be included in the Authorization header. You can get the token from here.
Parameters
Name | Type | Required | Description |
---|---|---|---|
name | string | Yes | Name of the WhatsApp session. |
phone_number | string | Yes | Phone number in international format. |
account_protection | boolean | Yes | Enable account protection features. |
log_messages | boolean | Yes | Enable message logging. |
webhook_url | string | No | URL for receiving webhook notifications. |
webhook_enabled | boolean | No | Enable webhook notifications. |
webhook_events | array | No | Array of events to receive webhook notifications for. |
Code Examples
curl -X POST "https://www.wasenderapi.com/api/whatsapp-sessions"
-H "Authorization: Bearer YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"name": "Sample Name",
"phone_number": "Sample Phone_number",
"account_protection": true,
"log_messages": true,
"webhook_url": "Sample Webhook_url",
"webhook_enabled": true,
"webhook_events": [
"number1",
"number2"
]
}'
Response Examples
{
"success": true,
"data": {
"id": 1,
"name": "Business WhatsApp",
"phone_number": "+1234567890",
"status": "connected",
"account_protection": true,
"log_messages": true,
"webhook_url": "https://example.com/webhook",
"webhook_enabled": true,
"webhook_events": [
"message",
"group_update"
],
"api_key": "75075a7bf6417bff59e76fb7205382c2dc74cf1769e76f382c2dc74cf176c0bf",
"webhook_secret": "fb61be92ddb7935e0cedcec58e470f6c",
"created_at": "2025-04-01T12:00:00Z",
"updated_at": "2025-05-08T15:30:00Z"
}
}