Skip to main content

Post, Reply, and Reaction Webhooks

Post and reply

In Bettermode, all posts and replies are considered as a Post. In most cases, you want to listen to post.published events.

post.published event is called when a post or reply is published.

When a post or reply is deleted post.deleted event is called.

In some cases, posts are not published right away and are sent for moderation. In the next section, you can learn more about the full lifecycle of publishing a post.

Post publishing lifecycle

When a post is created, no matter if it's a post or a reply, it's sent for moderation or not, it will result in post.created event. In case the post is not sent to moderation, it will also result in post.published event right away.

If the post is sent for moderation, it will result in post.blocked and moderation.created events. Community admins or moderators can either approve or reject the post from the moderation panel:

  • Approving the post will result in post.unblocked, post.published, and moderation.rejected (since the "sent to moderation" decision was wrong) events.

  • Rejecting the post will result in post.deleted and moderation.accepted (since the "sent to moderation" decision was accepted) events.

note

To differentiate replies from posts in post.created or post.published events, you can check the isReply field.

If a post is already published and is sent for moderation after getting updated, it will result in post.unpublished event.

The structure for all webhook requests around posts are as followed:

Event name: post.created
{
"networkId": "CAxOmI7I7t",
"context": "NETWORK",
"entityId": "CAxOmI7I7t",
"currentSettings": [],
"type": "SUBSCRIPTION",
"data": {
"time": "2021-12-20T04:23:32.223Z",
"verb": "PUBLISHED",
"verbAction": "PUBLISHED",
"actor": {
"id": "olQ88vTqYp",
"roleId": "Kni0OF7HtE",
"roleType": "admin",
"sessionInfo": [
null
],
"spaceRoleId": "j4pEix0TVdPH",
"spaceRoleType": "admin"
},
"object": {
"id": "7YLkAXyezVhHloA",
"networkId": "CAxOmI7I7t",
"spaceId": "kBMLH6nwC78J",
"postTypeId": "KQeY5us2v5DjDvZ",
"createdAt": "2021-12-20T04:23:32.032Z",
"updatedAt": "2021-12-20T04:23:32.032Z",
"publishedAt": "2021-12-20T04:23:32.223Z",
"status": "PUBLISHED",
"createdById": "olQ88vTqYp",
"ownerId": "olQ88vTqYp",
"isAnonymous": false,
"mentionedMembers": [],
"embedIds": [],
"imageIds": [],
"pinnedInto": [],
"repliedToId": null,
"repliedToIds": [],
"repliesCount": 0,
"totalRepliesCount": 0,
"seoDetail": [
null
],
"topRepliers": [],
"title": "Hello world",
"slug": "hello-world",
"shortContent": "<p>What a time to be alive!</p>",
"hasMoreContent": false,
"isReply": false,
"mappingFields": [
null
],
"primaryReactionType": "EMOJI_BASE",
"positiveReactionsCount": 0,
"negativeReactionsCount": 0,
"reactionsCount": 0,
"singleChoiceReactions": [],
"isHidden": false,
"positiveReactions": null,
"negativeReactions": null,
"allowedEmojis": null,
"forbiddenEmojis": null,
"attachmentIds": [],
"searchFields": [
null
]
},
"with": {},
"target": {
"organizationId": "i7RkgwKXwz",
"networkId": "CAxOmI7I7t",
"collectionId": "JJaH6objoJw3",
"spaceId": "kBMLH6nwC78J"
},
"id": "f2d51f56ceef439cf659f06797a66592",
"name": "post.published",
"noun": "POST",
"shortDescription": "Publish Post"
}
}

Reaction

When a member reacts to a post or reply reaction.added event is triggered. Removing a reaction from a post or reply will result in reaction.removed event.

The structure for both above events is as followed:

Event name: reaction.added
{
"networkId": "CAxOmI7I7t",
"context": "NETWORK",
"entityId": "CAxOmI7I7t",
"currentSettings": [],
"type": "SUBSCRIPTION",
"data": {
"time": "2021-12-20T02:30:10.401Z",
"verb": "ADDED",
"verbAction": "ADDED",
"actor": {
"id": "olQ88vTqYp",
"roleId": "Kni0OF7HtE",
"roleType": "admin",
"sessionInfo": [
null
],
"spaceRoleId": "j4pEix0TVdPH",
"spaceRoleType": "admin"
},
"object": {
"id": "75h68fcKoH4ps7iGixXa",
"networkId": "CAxOmI7I7t",
"spaceId": "kBMLH6nwC78J",
"createdAt": "2021-12-19T18:38:49.041Z",
"updatedAt": "2021-12-19T18:38:50.104Z",
"postId": "kCPt3feq0MCIT6w",
"reaction": "+1",
"count": 0,
"reacted": false
},
"target": {
"organizationId": "i7RkgwKXwz",
"networkId": "CAxOmI7I7t",
"collectionId": "JJaH6objoJw3",
"spaceId": "kBMLH6nwC78J",
"postId": "kCPt3feq0MCIT6w",
"memberId": "olQ88vTqYp"
},
"id": "ca0303107af9d45f5ab6d20df9728ce6",
"name": "reaction.added",
"noun": "REACTION",
"shortDescription": "Add Reaction"
}
}