API & Documentation

Welcome to the HeyDoc.in WhatsApp API documentation. This page provides a summary of the available API endpoints and how to use them. For full details, see the complete API documentation (Markdown).

Base URL

https://heydoc.in

Authentication

Most endpoints require authentication. Log in to obtain a session cookie, then include it in your requests.

POST /login
POST /register
GET /logout

Fetch Contact Chats

Retrieve all contacts and their chats, or fetch messages for a specific contact.

Get All Contacts
GET /api/contacts
Example Response:
[
  {
    "phone": "1234567890",
    "name": "John Doe",
    "last_message": "Hello there!",
    "message_count": 15,
    "unread_count": 2,
    "is_group": false,
    "tags": [
      { "id": 1, "name": "Family", "color": "#ff4444" }
    ]
  }
]
Get Messages for a Contact
GET /api/messages/{phone}?limit=20
Example Response:
[
  {
    "id": 1,
    "message_id": "msg_123",
    "sender_phone": "1234567890",
    "receiver_phone": "bot_number",
    "message_type": "text",
    "message_text": "Hello!",
    "timestamp": "2024-01-15T10:30:00Z",
    "direction": "incoming",
    "is_read": true,
    "status": "delivered"
  }
]

Scheduling Messages

Schedule messages to be sent at a future time.

Get All Scheduled Messages
GET /api/scheduled-messages
Example Response:
[
  {
    "id": 1,
    "message": "Hello!",
    "recipients": ["1234567890", "9876543210"],
    "scheduled_time": "2024-01-16T09:00:00Z",
    "status": "pending",
    "created_by": "admin"
  }
]
Schedule a New Message
POST /api/scheduled-messages
Content-Type: application/json
{
  "message": "Good morning!",
  "recipients": ["1234567890"],
  "scheduled_time": "2024-01-16T09:00:00Z",
  "recurrence": "daily"
}
Example Response:
{
  "success": true,
  "message": "Scheduled message created successfully"
}
Get a Scheduled Message
GET /api/scheduled-messages/{message_id}
Delete a Scheduled Message
DELETE /api/scheduled-messages/{message_id}
Update Scheduled Message Status
PUT /api/scheduled-messages/{message_id}/status
Content-Type: application/json
{
  "status": "sent"
}
Get Pending Scheduled Messages
GET /api/scheduled-messages/pending

Example: Send Message

POST /api/send_message
{
  "phone_number": "1234567890",
  "message": "Hello from the bot!"
}

Response Format

{
  "success": true,
  "data": {...},
  "message": "Operation completed successfully"
}

For a full list of endpoints and request/response examples, view the full API documentation.