Skip to content

Sure, here's the documentation for the provided cURL command:

Get Chat History for Specific Number

This API allows you to retrieve the chat history for a specific phone number using the Cellcast API.

Parameters for Get Chat History API

Headers Parameters

ParametersDescription
AuthorizationPlease add provided Bearer token - linked to your Cellcast account. Check here

Path Parameters

NameExampleDescription
numberconversation of numberThe conversation number of the sent message.

Code Samples

Get https://api.cellcast.com/api/v1/chat/:number

bash
curl --location 'https://api.cellcast.com/api/v1/chat/:number' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{API_KEY}}'
js
const axios = require("axios");

const getChatHistory = async (phoneNumber) => {
  try {
    const response = await axios.get(`https://api.cellcast.com/api/v1/chat/${phoneNumber}`, {
      headers: {
        Accept: "application/json",
        Authorization: "Bearer {{API_KEY}}",
      },
    });
    console.log(response.data);
  } catch (error) {
    console.error(error.response.data);
  }
};

Replace with the actual API key that you own.

Responses

200 OK

json
{
  "app_type": "web",
  "app_version": "1.0",
  "maintainence": 0,
  "new_version": 0,
  "force_update": 0,
  "invalid_token": 0,
  "refresh_token": "",
  "show_message": 0,
  "is_enc": false,
  "status": true,
  "message": "Chat history retrieved successfully",
  "message_type": "toast",
  "error": {},
  "data": [
    {
      "_id": "5f645ce76096856400000000",
      "rmsThreadKey": "1610792553597-1589370577-000000",
      "user": "5f62bf342f46507100000000",
      "subscriberNumber": 400000000,
      "templateId": "5f5ea7075c373b0d00000000",
      "rmsShortCode": "2555",
      "rmsChat": [
        {
          "isDeleted": false,
          "_id": "5f645ce76096856400000000",
          "rmsContent": "Hi",
          "type": "sms",
          "createdAt": "2021-01-15T09:02:33.598Z"
        },
        {
          "isDeleted": false,
          "_id": "5f645ce76096856400000000",
          "rmsContent": "Hello",
          "type": "sms",
          "createdAt": "2021-01-15T09:02:33.598Z"
        }
      ],
      "createdAt": "2021-01-15T09:02:33.598Z",
      "updatedAt": "2021-01-15T09:02:33.598Z",
      "__v": 0
    },
    {
      "_id": "5f645ce76096856400000000",
      "rmsThreadKey": "1610792553597-1589370577-000000",
      "user": "5f62bf342f4650719400000000",
      "subscriberNumber": 400000001,
      "templateId": "5f5ea7075c373b0d00000000",
      "rmsShortCode": "2555",
      "rmsChat": [
        {
          "isDeleted": false,
          "_id": "5f645ce760968564d00000000",
          "rmsContent": "Hi",
          "type": "sms",
          "createdAt": "2021-01-15T09:02:33.598Z"
        },
        {
          "isDeleted": false,
          "_id": "5f645ce76096856400000000",
          "rmsContent": "Hello",
          "type": "sms",
          "createdAt": "2021-01-15T09:02:33.598Z"
        }
      ],
      "createdAt": "2021-01-15T09:02:33.598Z",
      "updatedAt": "2021-01-15T09:02:33.598Z",
      "__v": 0
    }
  ]
}