> ## Documentation Index
> Fetch the complete documentation index at: https://docs.periskope.app/llms.txt
> Use this file to discover all available pages before exploring further.

# message.created

> The `message.created` webhook is triggered when a new message is received or sent on whatsapp.

<ResponseExample>
  ```json The Message Object theme={null}
  {
    "message_id": "true_12036329726967XXXX@g.us_3EB01F4653XX9XX05E9859_9190043XXXXX@c.us",
    "org_id": "2997xx64-89bf-48d3-9a22-b314fxx017e5",
    "ack": "2",
    "author": "9190043XXXXX@c.us",
    "body": "Hello, world",
    "broadcast": null,
    "device_type": "android",
    "flag_status": false,
    "duration": null,
    "forwarding_score": "0",
    "from": "9190043XXXXX@c.us",
    "from_me": true,
    "has_media": true,
    "has_quoted_msg": false,
    "has_reaction": false,
    "id": {
      "id": "3EB01F4653XX9XX05E9859",
      "fromMe": true,
      "remote": "12036329726967XXXX@g.us",
      "_serialized": "true_12036329726967XXXX@g.us_3EB01F4653XX9XX05E9859_9190043XXXXX@c.us"
    },
    "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": "12036329726967XXXX@g.us",
    "token": null,
    "message_type": "image",
    "vcards": [],
    "chat_id": "12036329726967XXXX@g.us",
    "timestamp": "2024-05-13 11:19:34+00",
    "org_phone": "9190043XXXXX@c.us",
    "broadcast_id": null,
    "is_deleted": null,
    "media": {
      "path": "/storage/v1/object/public/message-media/2997xx64-89bf-48d3-9a22-b314fxx017e5/12036329726967XXXX@g.us/true_12036329726967XXXX@g.us_3EB01F4653XX9XX05E9859_9190043XXXXX@c.us/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": "harsh.gour@hashlabs.dev",
    "prev_body": null,
    "quoted_message_id": null,
    "sender_phone": "9190043XXXXX@c.us",
    "sent_message_id": "f7b10126-5d5e-432f-941c-94ced28debac",
    "delivery_info": {
      "read": {
         "919XXXXXXXXXXX@c.us": 1731984657443
      },
      "pending": [
        "9184XXXXXXXXXX@c.us",
        "919XXXXXXXXXXX@c.us"
      ],
      "delivered": {
        "919XXXXXXXXXXX@c.us": 1731214159000,
        "919XXXXXXXXXXX@c.us": 1731195010000,
        "919XXXXXXXXXXX@c.us": 1731175846000,
        "919XXXXXXXXXXX@c.us": 1731175848000,
        "919XXXXXXXXXXX@c.us": 1731175847000
      },
      "read_count": 0,
      "delivered_count": 5
    },
     "flag_metadata": {
      "status": false,
      "response_id": "3A1AXXXXXXXXXX",
      "response_type": "message",
      "response_email": "91XXXXXXXXX@c.us",
      "response_timestamp": "2024-11-26T15:16:32.179Z"
    },
    "poll_info": {
      "options": {
        "allowMultipleAnswers": true
      },
      "pollName": "pollQuestion",
      "pollOptions": [
        "option1",
        "option2",
        "option3"
      ]
    },
    "poll_results": {
      "option1": {
        "91903XXXXXX0@c.us": "2024-05-24T15:24:11.336Z"
      },
      "option2": {},
      "option3": {}
    },
    "interactive": null,
    "updated_at": "2024-05-13 11:19:36.114+00",
    "message_ticket_id": null,
    "unique_id": "3EB01F4653XX9XX05E9859"
  }
  ```
</ResponseExample>

Refer [Message](/api-reference/objects/the-message-object) object to find more details about `message object`.

<RequestExample>
  ```ts Node.js theme={null}
  import { PeriskopeApi } from '@periskope/periskope-client';

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

  client.on('message.created', (data) => {
    console.log(data);
  });
  ```
</RequestExample>

### Event structure 📦

You'll be receiving the data in the following format:

```json theme={null}
{
  "event": "<event-type>",
  "data": "<event-data>", // complete data object as mentioned in Objects section
  "org_id": "<your-organisation-id>",
  "timestamp": "<timestamp>" // timestamp of the event creation
}
```
