import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function getMessage() {
const response = await client.message.getById({
message_id: '[email protected]_3EB0F754E67BDF3178E76C680224FF7114E2CB95'
});
console.log(response);
}
getMessage();{
"ack": "3",
"author": null,
"body": "Hello, Edited World 2",
"broadcast": null,
"broadcast_id": null,
"chat_id": "[email protected]",
"delivery_info": {
"delivered": {
"[email protected]": 1737967705196
},
"delivered_count": 1,
"pending": [],
"read": {
"[email protected]": 1737967704763
},
"read_count": 1
},
"device_type": null,
"duration": null,
"flag_metadata": null,
"flag_response_time": null,
"flag_status": null,
"forwarding_score": null,
"from": null,
"from_me": true,
"fts": "'2':4 'edit':2 'hello':1 'world':3",
"has_media": null,
"has_quoted_msg": null,
"has_reaction": null,
"id": {
"from_me": true,
"id": "3EB0C62861626B2D8BD4A386E48976EC85CB009C",
"remote": "[email protected]",
"serialized": "[email protected]_3EB0C62861626B2D8BD4A386E48976EC85CB009C"
},
"invite_v4": null,
"is_deleted": null,
"is_ephemeral": null,
"is_forwarded": null,
"is_gif": null,
"is_starred": null,
"is_status": null,
"links": null,
"location": null,
"media": null,
"media_key": null,
"mentioned_ids": [],
"message_id": "[email protected]_3EB0C62861626B2D8BD4A386E48976EC85CB009C",
"message_ticket_id": null,
"message_type": "chat",
"order_id": null,
"org_id": "2997dd64-89bf-48d3-9a22-b314fca017e5",
"org_phone": "[email protected]",
"performed_by": null,
"poll_info": null,
"poll_results": null,
"prev_body": "Hello, Edited World",
"quoted_message_id": null,
"raw_data": null,
"reactions": [
{
"ack": null,
"chat_id": "[email protected]",
"id": {
"from_me": true,
"id": "3EB0A92AE3DE31D97BAEC6",
"remote": "[email protected]",
"serialized": "[email protected]_3EB0A92AE3DE31D97BAEC6"
},
"message_id": "[email protected]_3EB0C62861626B2D8BD4A386E48976EC85CB009C",
"msg_id": {
"from_me": true,
"id": "3EB0C62861626B2D8BD4A386E48976EC85CB009C",
"remote": "[email protected]",
"serialized": "[email protected]_3EB0C62861626B2D8BD4A386E48976EC85CB009C"
},
"org_id": "2997dd64-89bf-48d3-9a22-b314fca017e5",
"org_phone": "[email protected]",
"orphan": null,
"orphan_reason": null,
"reaction": "😄",
"reaction_id": "[email protected]_3EB0A92AE3DE31D97BAEC6",
"read": true,
"sender_id": "[email protected]",
"timestamp": "2025-01-28T05:11:57.008+00:00",
"unique_id": "3EB0C62861626B2D8BD4A386E48976EC85CB009C"
}
],
"sender_phone": "[email protected]",
"sent_message_id": "459d1ec5-1d0d-4170-947b-4ad4adca5ba9",
"timestamp": "2025-01-27T08:48:24+00:00",
"to": null,
"token": null,
"unique_id": "3EB0C62861626B2D8BD4A386E48976EC85CB009C",
"updated_at": "2025-01-28T05:11:38.221+00:00",
"vcards": null
}This endpoint retrieves a specific message based on the message_id or queue_id
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function getMessage() {
const response = await client.message.getById({
message_id: '[email protected]_3EB0F754E67BDF3178E76C680224FF7114E2CB95'
});
console.log(response);
}
getMessage();{
"ack": "3",
"author": null,
"body": "Hello, Edited World 2",
"broadcast": null,
"broadcast_id": null,
"chat_id": "[email protected]",
"delivery_info": {
"delivered": {
"[email protected]": 1737967705196
},
"delivered_count": 1,
"pending": [],
"read": {
"[email protected]": 1737967704763
},
"read_count": 1
},
"device_type": null,
"duration": null,
"flag_metadata": null,
"flag_response_time": null,
"flag_status": null,
"forwarding_score": null,
"from": null,
"from_me": true,
"fts": "'2':4 'edit':2 'hello':1 'world':3",
"has_media": null,
"has_quoted_msg": null,
"has_reaction": null,
"id": {
"from_me": true,
"id": "3EB0C62861626B2D8BD4A386E48976EC85CB009C",
"remote": "[email protected]",
"serialized": "[email protected]_3EB0C62861626B2D8BD4A386E48976EC85CB009C"
},
"invite_v4": null,
"is_deleted": null,
"is_ephemeral": null,
"is_forwarded": null,
"is_gif": null,
"is_starred": null,
"is_status": null,
"links": null,
"location": null,
"media": null,
"media_key": null,
"mentioned_ids": [],
"message_id": "[email protected]_3EB0C62861626B2D8BD4A386E48976EC85CB009C",
"message_ticket_id": null,
"message_type": "chat",
"order_id": null,
"org_id": "2997dd64-89bf-48d3-9a22-b314fca017e5",
"org_phone": "[email protected]",
"performed_by": null,
"poll_info": null,
"poll_results": null,
"prev_body": "Hello, Edited World",
"quoted_message_id": null,
"raw_data": null,
"reactions": [
{
"ack": null,
"chat_id": "[email protected]",
"id": {
"from_me": true,
"id": "3EB0A92AE3DE31D97BAEC6",
"remote": "[email protected]",
"serialized": "[email protected]_3EB0A92AE3DE31D97BAEC6"
},
"message_id": "[email protected]_3EB0C62861626B2D8BD4A386E48976EC85CB009C",
"msg_id": {
"from_me": true,
"id": "3EB0C62861626B2D8BD4A386E48976EC85CB009C",
"remote": "[email protected]",
"serialized": "[email protected]_3EB0C62861626B2D8BD4A386E48976EC85CB009C"
},
"org_id": "2997dd64-89bf-48d3-9a22-b314fca017e5",
"org_phone": "[email protected]",
"orphan": null,
"orphan_reason": null,
"reaction": "😄",
"reaction_id": "[email protected]_3EB0A92AE3DE31D97BAEC6",
"read": true,
"sender_id": "[email protected]",
"timestamp": "2025-01-28T05:11:57.008+00:00",
"unique_id": "3EB0C62861626B2D8BD4A386E48976EC85CB009C"
}
],
"sender_phone": "[email protected]",
"sent_message_id": "459d1ec5-1d0d-4170-947b-4ad4adca5ba9",
"timestamp": "2025-01-27T08:48:24+00:00",
"to": null,
"token": null,
"unique_id": "3EB0C62861626B2D8BD4A386E48976EC85CB009C",
"updated_at": "2025-01-28T05:11:38.221+00:00",
"vcards": null
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Please provide the number of the phone you want to call with this API in the header. The number must be in country code + number format without any characters or spaces, e.g. 919876543210; Alternatively, provide the phone_id (phone-xxxxxxxxxxxx) in the header
"{{orgPhone}}"
"[email protected]_3EB0C62861626B2D8BD4A386E48976EC85CB009C"
200 OK
The response is a message object. Refer to the message object here
Was this page helpful?