Skip to main content
{
  "message_id": "[email protected][email protected]",
  "org_id": "2997xx64-89bf-48d3-9a22-b314fxx017e5",
  "ack": "2",
  "author": "[email protected]",
  "body": "Hello, world",
  "broadcast": null,
  "device_type": "android",
  "flag_status": false,
  "duration": null,
  "forwarding_score": "0",
  "from": "[email protected]",
  "from_me": true,
  "has_media": true,
  "has_quoted_msg": false,
  "has_reaction": false,
  "id": {
    "id": "3EB01F4653XX9XX05E9859",
    "fromMe": true,
    "remote": "[email protected]",
    "_serialized": "[email protected][email protected]"
  },
  "invite_v4": null,
  "is_ephemeral": null, //disappearing messages
  "is_forwarded": false,
  "is_gif": false,
  "is_starred": false,
  "is_status": false,
  "links": "[]",
  "location": null,
  "media_key": null,
  "mentioned_ids": [],
  "order_id": null,
  "raw_data": null,
  "to": "[email protected]",
  "token": null,
  "message_type": "image",
  "vcards": [],
  "chat_id": "[email protected]",
  "timestamp": "2024-05-13 11:19:34+00",
  "org_phone": "[email protected]",
  "broadcast_id": null,
  "is_deleted": null,
  "media": {
    "path": "/storage/v1/object/public/message-media/2997xx64-89bf-48d3-9a22-b314fxx017e5/[email protected]/[email protected][email protected]/dbd33c9e-bedc-4df7-8a4c-f9eadf957ac9",
    "size": 19940,
    "filename": "dbd33c9e-bedc-4df7-8a4c-f9eadf957ac9",
    "mimetype": "image/jpeg",
    "dimensions": {
      "ar": 1,
      "width": 512,
      "height": 512
    }
  },
  "performed_by": "[email protected]",
  "prev_body": null,
  "quoted_message_id": null,
  "sender_phone": "[email protected]",
  "sent_message_id": "f7b10126-5d5e-432f-941c-94ced28debac",
  "delivery_info": {
    "read": {
       "[email protected]": 1731984657443
    },
    "pending": [
      "[email protected]",
      "[email protected]"
    ],
    "delivered": {
      "[email protected]": 1731214159000,
      "[email protected]": 1731195010000,
      "[email protected]": 1731175846000,
      "[email protected]": 1731175848000,
      "[email protected]": 1731175847000
    },
    "read_count": 0,
    "delivered_count": 5
  },
   "flag_metadata": {
    "status": false,
    "response_id": "3A1AXXXXXXXXXX",
    "response_type": "message",
    "response_email": "[email protected]",
    "response_timestamp": "2024-11-26T15:16:32.179Z"
  },
  "poll_info": {
    "options": {
      "allowMultipleAnswers": true
    },
    "pollName": "pollQuestion",
    "pollOptions": [
      "option1",
      "option2",
      "option3"
    ]
  },
  "poll_results": {
    "option1": {
      "[email protected]": "2024-05-24T15:24:11.336Z"
    },
    "option2": {},
    "option3": {}
  },
  "updated_at": "2024-05-13 11:19:36.114+00",
  "message_ticket_id": null,
  "unique_id": "3EB01F4653XX9XX05E9859"
}
Refer Message object to find more details about message object.
import { PeriskopeApi } from '@periskope/periskope-client';

const client = new PeriskopeApi({
  authToken: 'YOUR_API_KEY',
  phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});

client.on('message.flagged', (data) => {
  console.log(data);
});

Event structure 📦

You’ll be receiving the data in the following format:
{
  "event": "<event-type>",
  "data": "<event-data>", // complete data object as mentioned in Objects section
  "org_id": "<your-organisation-id>",
  "previous_attributes": "<previous-attributes>", // attributes changes in new object. In case of an update event.
  "timestamp": "<timestamp>" // timestamp of the event creation
}