Events & Actions payloads

Events & Actions delivers every event as JSON. The exact shape depends on the event type and on the envelope option you pick for the action, described on Available actions. This page shows all four variants for every event type so you can match what your action receives:

  • No Envelope, containing the event's dataSchema and a data array, without the envelope metadata. Every event type uses this layout, and the envelope version set on the action doesn't change it.
  • V1, an enveloped format that puts the event in an event object next to Events & Actions listener and action metadata. V1 has two layouts. Message sent and File sent use an eventsAndActionsMetadata object. The other event types use a top-level schema and a metadata object with ena:listener and ena:action keys, and name the event's schema key schema instead of dataSchema.
  • V2, an enveloped format that wraps the event in a metadata object with provenance.
  • V2.1, a refinement of V2.

See Available actions for the current envelope default and selection rules.

A few fields depend on the event or the action, not only on the envelope:

  • The channel key is pubsub:channel in V1 and pubsub.channel in V2. V2.1 doesn't include it. Events without a channel omit it in every version.
  • In V1 Message sent and File sent payloads, eventType is message.publish for both events.
  • In V1 Message sent and File sent payloads, the samples show webhookMetadata because they come from a Webhook action. Other action types name this object after the action type, for example kafkaMetadata or sqsMetadata.

The dataSchema and schema values are identifiers, not URLs you can open. Compare them as exact strings to tell event types apart.

Identifier fields vary by event type and envelope. Message and File payloads use senderId; Message Actions and App Context payloads use userId; Presence payloads can contain uuid inside their presence data. These fields hold the User ID value where shown. Use the field in the variant that your action sends.

Payloads are grouped by source, producer, and event type, matching the Event sources reference. Jump to a source:

Messages​

This section lists the payload for every event type in the Messages event source.

Pub/Sub​

Message sent​

1{
2 "dataSchema": "pubnub.com/schemas/events/messages.pubsub.publish?v=1.0.0",
3 "data": [
4 {
5 "timestamp": "2025-06-05T12:53:15.888Z",
6 "message": "Message Test",
7 "meta": null,
8 "senderId": "Jack-device",
9 "channel": "Channel-Barcelona",
10 "timetoken": "17491279958880737"
11 }
12 ]
13}

Message Actions​

Message action created​

1{
2 "dataSchema": "pubnub.com/schemas/events/messages.action.created?v=1.0.0",
3 "data": [
4 {
5 "id": "50354a63-8ba3-42b2-93e1-d1bbc17d93a1",
6 "channel": "channel1",
7 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
8 "messageTimetoken": "17500733512701872",
9 "timestamp": "2025-06-16T11:29:21.037191Z",
10 "type": "1",
11 "value": "1",
12 "userId": "User1"
13 }
14 ]
15}

Message action deleted​

1{
2 "dataSchema": "pubnub.com/schemas/events/messages.action.deleted?v=1.0.0",
3 "data": [
4 {
5 "id": "580022c7-a3df-4fc2-aa00-556813236ec4",
6 "channel": "test_channel_1",
7 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
8 "messageTimetoken": "17491299520205486",
9 "timestamp": "2025-06-05T13:31:38.148778Z",
10 "type": "Reaction",
11 "value": "true",
12 "userId": "Test Message Actions User"
13 }
14 ]
15}

Files​

File sent​

1{
2 "dataSchema": "pubnub.com/schemas/events/messages.pubsub.publish?v=1.0.0",
3 "data": [
4 {
5 "channel": "file-transfer-demo",
6 "fileId": "3ec34dbc-3b6f-443f-8991-427a327abd7e",
7 "fileName": "testfile1.txt",
8 "message": {
9 "example": "message"
10 },
11 "meta": null,
12 "senderId": "Test Files User",
13 "timestamp": "2025-06-05T13:18:17.665Z",
14 "timetoken": "17491294976652491"
15 }
show all 17 lines

Users​

This section lists the payload for every event type in the Users event source.

Presence​

User state changed in channel​

1{
2 "dataSchema": "pubnub.com/schemas/events/presence.channel.user.state.in.changed?v=1.0.0",
3 "data": [
4 {
5 "id": "889e9b63-0d4d-4d3c-808d-b226f5dc6504",
6 "channel": "Channel-Barcelona",
7 "userId": "Jack-device",
8 "data": {
9 "action": "state-change",
10 "uuid": "Jack-device",
11 "timestamp": "1749128108",
12 "precise_timestamp": "1749128108494",
13 "data": "{\"state\":\"test-state\"}",
14 "occupancy": "0"
15 },
show all 20 lines

CRUD​

User created​

1{
2 "dataSchema": "pubnub.com/schemas/events/user.created?v=1.0.0",
3 "data": [
4 {
5 "id": "9dc756ca-0be4-4c82-bc46-84e1a08782fb",
6 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
7 "timestamp": "2025-06-05T13:11:54.517788662Z",
8 "eTag": "520565d0095710aaac47b437a0b51c4f",
9 "userId": "User_id",
10 "name": "User Name",
11 "email": "",
12 "profileUrl": "",
13 "externalId": "",
14 "type": "",
15 "status": ""
show all 18 lines

User updated​

1{
2 "dataSchema": "pubnub.com/schemas/events/user.updated?v=1.0.0",
3 "data": [
4 {
5 "id": "7044631a-f86e-4df3-9303-9bb490f4b64f",
6 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
7 "timestamp": "2025-06-05T13:35:14.735278571Z",
8 "eTag": "87e4956864cd39abe4ceaea8a22f375b",
9 "userId": "User_id",
10 "fields": {
11 "name": "User Name Updated"
12 }
13 }
14 ]
15}

User deleted​

1{
2 "dataSchema": "pubnub.com/schemas/events/user.deleted?v=1.0.0",
3 "data": [
4 {
5 "id": "df0cdbe6-7505-49e2-9a24-9307174b1d38",
6 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
7 "timestamp": "2025-06-16T09:09:16.475127588Z",
8 "userId": "User_id6"
9 }
10 ]
11}

Channels​

This section lists the payload for every event type in the Channels event source.

CRUD​

Channel created​

1{
2 "dataSchema": "pubnub.com/schemas/events/channel.created?v=1.0.0",
3 "data": [
4 {
5 "id": "e2467259-b0f0-4e64-ac9f-b9a44cd8a7c4",
6 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
7 "timestamp": "2025-06-16T09:10:24.844778615Z",
8 "eTag": "1e5c41f43cca3f3643524175268cddf6",
9 "channelId": "channel_1",
10 "name": "channel_1",
11 "description": "",
12 "type": "",
13 "status": ""
14 }
15 ]
show all 16 lines

Channel updated​

1{
2 "dataSchema": "pubnub.com/schemas/events/channel.updated?v=1.0.0",
3 "data": [
4 {
5 "id": "7ca8f612-ca63-406e-add3-4510bf55558b",
6 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
7 "timestamp": "2025-06-16T09:11:03.439309673Z",
8 "eTag": "eab2bd4c72aadf93e06d9d9084668e6a",
9 "channelId": "channel_1",
10 "fields": {
11 "space": "channel_12"
12 }
13 }
14 ]
15}

Channel deleted​

1{
2 "dataSchema": "pubnub.com/schemas/events/channel.deleted?v=1.0.0",
3 "data": [
4 {
5 "id": "63982247-db79-43b9-bf3a-39e647f23292",
6 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
7 "timestamp": "2025-06-16T09:11:15.215130220Z",
8 "channelId": "channel_1"
9 }
10 ]
11}

Presence​

First user subscribed to channel​

1{
2 "dataSchema": "pubnub.com/schemas/events/presence.channel.state.active?v=1.0.0",
3 "data": [
4 {
5 "id": "0dc3f00a-06d2-4849-b511-ea9e1817c461",
6 "timestamp": "2025-06-16T09:11:26.809Z",
7 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
8 "channel": "Channel-Barcelona"
9 }
10 ]
11}

Last user left channel​

1{
2 "dataSchema": "pubnub.com/schemas/events/presence.channel.state.inactive?v=1.0.0",
3 "data": [
4 {
5 "id": "bd688fba-d66e-4900-b3ae-902db0c092e0",
6 "timestamp": "2025-06-16T12:09:27.254Z",
7 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
8 "channel": "Channel-Barcelona"
9 }
10 ]
11}

User started subscription to channel​

1{
2 "dataSchema": "pubnub.com/schemas/events/presence.user.channel.joined?v=1.0.0",
3 "data": [
4 {
5 "id": "a36773df-d828-4d40-99ab-26b8ebe46e41",
6 "channel": "Channel-Barcelona",
7 "userId": "Jack-device",
8 "occupancy": 2,
9 "data": {
10 "occupancy": "2",
11 "action": "join",
12 "timestamp": "1750065086",
13 "precise_timestamp": "1750065086809",
14 "uuid": "Jack-device"
15 },
show all 20 lines

User stopped subscription to channel​

1{
2 "dataSchema": "pubnub.com/schemas/events/presence.user.channel.left?v=1.0.0",
3 "data": [
4 {
5 "id": "2cf3a1cb-6039-4745-a2e0-7c0b40051bb4",
6 "channel": "Channel-Barcelona",
7 "userId": "Amanda-device",
8 "occupancy": 1,
9 "data": {
10 "uuid": "Amanda-device",
11 "precise_timestamp": "1750065124663",
12 "timestamp": "1750065124",
13 "occupancy": "1",
14 "action": "leave"
15 },
show all 20 lines

User timed out while subscribing to channel​

1{
2 "dataSchema": "pubnub.com/schemas/events/presence.user.timedout.in.channel?v=1.0.0",
3 "data": [
4 {
5 "channelId": "meeting-9xs243ia-attendees",
6 "userId": "b631fe64-4d84-488e-8315-827f91400d1e",
7 "occupancy": 0,
8 "data": {}
9 }
10 ]
11}

Interval occupancy counted​

1{
2 "dataSchema": "pubnub.com/schemas/events/presence.channel.occupancy.counted?v=1.0.0",
3 "data": [
4 {
5 "id": "56fa7b98-56b5-433b-a4f4-247e72729d3a",
6 "channel": "Channel-Barcelona",
7 "occupancy": 7,
8 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
9 "timestamp": "2025-06-16T09:27:37.080Z"
10 }
11 ]
12}

Mobile Push Notifications​

This section lists the payload for every event type in the Mobile Push Notifications event source.

Devices​

Device removed​

1{
2 "dataSchema": "pubnub.com/schemas/events/push.device.removed?v=1.0.0",
3 "data": [
4 {
5 "id": "12345",
6 "action": "remove",
7 "device": "device_token_abc",
8 "platform": "ios",
9 "timestamp": "2024-06-10T12:34:56Z",
10 "subKey": "sub-c-xyz",
11 "oldDevice": "old_device_token_def"
12 }
13 ]
14}

Push error​

1{
2 "dataSchema": "pubnub.com/schemas/events/push.message.sending.failed?v=1.0.0",
3 "data": [
4 {
5 "id": "52301823-51f5-47d7-962c-16ac657f752a",
6 "channel": "pn-in.dFVj.lpxY",
7 "devices": "",
8 "platform": "apns",
9 "timestamp": "2025-06-18T04:16:59.353913Z",
10 "subKey": "sub-c-a5015666-3dd3-42df-8074-d37d647e8fe9",
11 "state": "error",
12 "payload": "APNS payload error: APNS notification exceeds max size"
13 }
14 ]
15}

Memberships​

This section lists the payload for every event type in the Memberships event source.

CRUD​

Membership created​

1{
2 "dataSchema": "pubnub.com/schemas/events/membership.created?v=1.0.0",
3 "data": [
4 {
5 "id": "2ca7fef7-6896-4a51-953d-7e4aeb16ec45",
6 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
7 "timestamp": "2025-06-16T09:15:46.035118335Z",
8 "eTag": "Afah2qS199e74QE",
9 "channelId": "100",
10 "userId": "user-123",
11 "type": "",
12 "status": ""
13 }
14 ]
15}

Membership updated​

1{
2 "dataSchema": "pubnub.com/schemas/events/membership.updated?v=1.0.0",
3 "data": [
4 {
5 "id": "579e8253-f846-437a-abbd-1d353f07d2cb",
6 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
7 "timestamp": "2025-06-16T09:16:04.950644238Z",
8 "eTag": "Ad6Y0N6U1IqLDw",
9 "channelId": "123",
10 "userId": "user-123",
11 "fields": {
12 "status": "dfgasd"
13 }
14 }
15 ]
show all 16 lines

Membership deleted​

1{
2 "dataSchema": "pubnub.com/schemas/events/membership.deleted?v=1.0.0",
3 "data": [
4 {
5 "id": "7323e044-953d-4bd5-9518-62bf5d3f3502",
6 "subKey": "sub-c-b0451d-1337-4b42-bee0-1905c7c02db",
7 "timestamp": "2025-06-16T09:16:17.948145898Z",
8 "channelId": "123",
9 "userId": "user-123"
10 }
11 ]
12}

Next steps​

  • Events & Actions. Understand the event, listener, and action model these payloads come from.
  • Event sources. Look up which event types each source produces.
  • Available actions. Pick the envelope version an action uses, and see the retry and batching rules that apply to the payload it sends.
  • Configure Events & Actions. Create a listener and pick an envelope option for its action.

Was this page useful?

Last updated on