Skip to content

Instantly share code, notes, and snippets.

@yo1dog
Created May 15, 2024 18:10
Show Gist options
  • Save yo1dog/3d8cf235b04177a945359e3d446726a3 to your computer and use it in GitHub Desktop.
Save yo1dog/3d8cf235b04177a945359e3d446726a3 to your computer and use it in GitHub Desktop.
{
"event": {
"id": "714cedbf-8ee4-4d04-a0f3-e58964811e09",
"payload": {
"dataSchema": "pubnub.com/schemas/events/messages.pubsub.publish?v=1.0.0",
"data": [
{
"timestamp": "2024-05-15T16:31:57.009Z",
"message": {
"type": "activeUsersRefreshed",
"payload": {
"teamID": "d42fc5c0-f016-4f12-a1e0-5138c1f1a30a",
"activeUsers": [
{
"userID": "173eedc8-4877-4ecf-82ae-e7acf46b4bb3",
"teamID": "d42fc5c0-f016-4f12-a1e0-5138c1f1a30a",
"givenName": "Adam",
"familyName": "🪜",
"profileImgImgixURL": "https://ladderteams.imgix.net/profile-images/8E0C60C8-B0EA-4759-8B84-ACB36C226396.jpg",
"streakCount": 3,
"workoutSessionID": "38c4b538-e358-48fc-bb17-2768405afa4d",
"workoutSessionStartedTS": "2024-05-15T15:49:52.725Z",
"workoutSessionPercentCompleted": "0.00"
}
]
}
},
"meta": null,
"senderId": "009d8b38-91bf-11ec-824e-00155d3adb60"
}
]
}
},
"metadata": {
"definitional": [
{
"pubsub.channel": "oob_team.d42fc5c0-f016-4f12-a1e0-5138c1f1a30a"
}
],
"provenance": {
"listenerId": "5f68fc6d-fa4a-4603-8119-01d186571305",
"action": {
"id": "47e6b4ed-ece8-44fe-bd22-a98eb6aa48c7",
"instanceId": "4b38c9ee-885e-460e-87a6-ee9127971754",
"invocation": {
"id": "7baae575-5745-47ea-a2fb-9504cdc50ce7",
"attempt": 0
}
}
}
},
"schema": "https://www.pubnub.com/schemas/edp.ena.event?schema-instance+json?v=2.0"
}
@yo1dog
Copy link
Author

yo1dog commented May 15, 2024

export const handler = async (event) => {
  console.log(JSON.stringify(JSON.parse(event.Records?.[0]?.body)), null, 2);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment