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. |
read_incoming_messages | boolean | No | Enable the option to automatically mark messages as read when they are received. |
auto_reject_calls | boolean | No | Enable automatic rejection of incoming calls. |
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,
"read_incoming_messages": True,
"webhook_url": "Sample Webhook_url",
"webhook_enabled": True,
"webhook_events": [
"messages.received",
"session.status",
"messages.update"
]
}'
Response Examples
{
"success": true,
"data": {
"id": 1,
"name": "Business WhatsApp",
"phone_number": "+1234567890",
"status": "connected",
"account_protection": true,
"log_messages": true,
"read_incoming_messages": true,
"webhook_url": "https://example.com/webhook",
"webhook_enabled": true,
"webhook_events": [
"messages.received",
"session.status",
"messages.update"
],
"api_key": "75075a7bf6417bff59e76fb7205382c2dc74cf1769e76f382c2dc74cf176c0bf",
"webhook_secret": "fb61be92ddb7935e0cedcec58e470f6c",
"created_at": "2025-04-01T12:00:00Z",
"updated_at": "2025-05-08T15:30:00Z"
}
}