External APIData Retrieval APIs

Get API Request Logs

This endpoint retrieves logs of API requests with various filtering options.

Endpoint

GET https://client-api.wappcloud.com/api/v1/external/api-requests

Authentication

  • x-api-key (required) — Your API key for authentication.

  • Authorization (required) — Bearer token for authentication. Format: Bearer <your_token>

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoPage number for pagination (default: 1)
limitintegerNoNumber of items per page (default: 10)
sentbooleanNoFilter by sent status
readbooleanNoFilter by read status
template_namestringNoFilter by template name
message_uidstringNoFilter by specific message UID
start_datedateNoFilter by start date (YYYY-MM-DD)
end_datedateNoFilter by end date (YYYY-MM-DD)
contact_numberstringNoFilter by contact number
contact_namestringNoFilter by contact name

Example Request

GET /external/api-requests?page=3&limit=10&sent=true&read=false
    &template_name=location&message_uid=6a7d01ee8de8488a
    &start_date=2025-07-02&end_date=2025-07-02

x-api-key: your_api_key_here

Response (200 OK)

{
  "code": 200,
  "message": "API logs fetched successfully",
  "success": true,
  "data": {
    "totalMessages": 10,
    "sentCount": 0,
    "deliveredCount": 0,
    "readCount": 0,
    "failedCount": 0,
    "logs": [
      {
        "template_name": "hello_world",
        "message_uid": "583e40b0c04347c7",
        "contact_number": "+919xxxxxxxxxx",
        "contact_name": "John Doe",
        "sent": null,
        "delivered": null,
        "read": null,
        "failed": null,
        "createdAt": "2025-07-02T04:25:49.001Z"
      }
      // ... more log entries
    ],
    "paginationDetails": {
      "totalCount": 64,
      "totalPages": 7,
      "currentPage": 1,
      "nextPage": 2,
      "prevPage": null
    }
  }
}

Response Fields

Data Object:

  • totalMessages (integer): Total number of messages matching the filter criteria.

  • sentCount (integer): Number of sent messages.

  • deliveredCount (integer): Number of delivered messages.

  • readCount (integer): Number of read messages.

  • failedCount (integer): Number of failed messages.

  • logs (array): Array of log objects.

  • paginationDetails (object): Pagination information.

Log Object:

  • template_name (string): Name of the template used.

  • message_uid (string): Unique identifier for the message.

  • contact_number (string/null): Contact number of the recipient.

  • contact_name (string/null): Contact name of the recipient.

  • sent (boolean/null): Whether the message was sent.

  • delivered (boolean/null): Whether the message was delivered.

  • read (boolean/null): Whether the message was read.

  • failed (boolean/null): Whether the message failed.

  • createdAt (string): ISO 8601 timestamp of creation.

Pagination Details:

  • totalCount (integer): Total number of items.

  • totalPages (integer): Total number of pages.

  • currentPage (integer): Current page number.

  • nextPage (integer/null): Next page number, null if on last page.

  • prevPage (integer/null): Previous page number, null if on first page.

Error Responses

401 Unauthorized

Missing or invalid API key.

400 Bad Request

Invalid query parameters.

Notes:

  • All date filters are inclusive.

  • Boolean filters (sent, read) should be passed as true or false.

  • The response is paginated with a default of 10 items per page.


Get Conversations API

This endpoint retrieves a list of conversations with filtering and pagination options.

Endpoint

GET https://client-api.wappcloud.com/api/v1/external/conversations

Authentication

  • x-api-key (required): Your API key for authentication.

  • Authorization (required): Bearer token in the format: Authorization: Bearer <your_token>

Query Parameters

ParameterTypeRequiredDescription
pagestringNoPage number for pagination (default: 1)
limitstringNoNumber of items per page (default: 10)
message_directionstringNoFilter by message direction: incoming or outgoing
contact_namestringNoFilter by contact name
contact_numberstringNoFilter by contact number

Example Request

GET /external/conversations?page=1&limit=10&message_direction=incoming

x-api-key: your_api_key_here
Authorization: Bearer your_token_here

Response (200 OK)

{
  "chats": [
    {
      "_id": "6501a1c2f1e4b2001a9b1234",
      "convoId": "65019f9ef1e4b2001a9b5678",
      "contactId": "65019f9ef1e4b2001a9b9999",
      "contactName": "Rahul Sharma",
      "contactNumber": 9876541230,
      "message_direction": "incoming",
      "message_body": "Hello, is the order ready?",
      "message_type": "text",
      "media_url": null,
      "createdAt": "2025-08-25T10:15:30.000Z",
      "updatedAt": "2025-09-01T08:20:10.000Z"
    }
    // ... more entries
  ],
  "totalCount": 4,
  "totalPages": 1,
  "currentPage": 1,
  "nextPage": null,
  "prevPage": null
}

Response Fields

Root Object:

  • chats (array): List of conversations.

  • totalCount (integer): Total number of conversations matching filters.

  • totalPages (integer): Total number of pages available.

  • currentPage (integer): Current page number.

  • nextPage (integer/null): Next page number, null if none.

  • prevPage (integer/null): Previous page number, null if none.

Conversation Object:

  • _id (string): Conversation ID.

  • convoId (string): Same as _id, represents the conversation identifier.

  • contactId (string): Unique contact identifier.

  • contactName (string): Name of the contact.

  • contactNumber (number): Contact’s phone number.

  • message_direction (string): Direction of the message (incoming or outgoing).

  • message_body (string): Content of the message.

  • message_type (string): Type of message (text, file, etc.).

  • media_url (string): URL of the media file (if any).

  • createdAt (string): ISO 8601 timestamp when message was created.

  • updatedAt (string): ISO 8601 timestamp when message was last updated.

Error Responses

401 Unauthorized

{
  "code": 401,
  "message": "Missing or invalid API key or token",
  "success": false
}

400 Bad Request

{
  "code": 400,
  "message": "Invalid query parameters",
  "success": false
}

Notes:

  • All date filters are inclusive.

  • Pagination defaults: page=1, limit=10.

  • Conversations are sorted by updatedAt (latest first).