guides / Webhook
Emmanuel avatar

Emmanuel

Notification

Headers


Notification headers contain the following informations:

Header nameExample valueDescription
Content-Typeapplication/jsonSpecify the JSON content of the request.
Content-Length770The length of the Notification payload in bytes.
X-Hub-Signaturef47ff6fe9d524f5...d195fa9e6672eThe signature of the request. See the section about this signature for more informations.

Payloads

Every notification payloads contain common fields:

FieldTypeDescription
versionnumberThe current version of Bodyguard's Webhooks.
challengeStringSee Challenge section.
timenumber (timestamp)The time at which the event was triggered.
organizationObjectDetails about your Organization (name and ID).
eventTypeStringThe event that triggered the Webhook.

Each eventType has its own dedicated field:

ObjectTypeDescription
messageUpdatedDataMessageTriggered when the eventType field is MESSAGE_UPDATED.
authorUpdatedDataAuthorTriggered when the eventType field is AUTHOR_UPDATED.
contentUpdatedDataPostTriggered when the eventType field is CONTENT_UPDATED.

Example:

{
    "version": 1,
    "challenge": "b4835ef24b353a16760262ad55fe8b2e574ad2fefaafd5870632fc7437309e01",
    "time": 1623764480,
    "organization": {
        "name": "Your organization name",
        "id": "The identifier of your organization"
    },
    "eventType": "MESSAGE_UPDATED | AUTHOR_UPDATED | CONTENT_UPDATED",
    "messageUpdatedData | authorUpdatedData | contentUpdatedData": {
        // ... Depending on the eventType
    }
}

MessageUpdatedData


The messageUpdatedData object contains the following fields:

FieldTypeDescription
channelIdStringThe Channel identifier bound to the Message.
sourceIdStringThe Source identifier bound to the Channel.
previousMessageMessagePrevious Message data.
newMessageMessageNew Message data.

Example:

{
    // ... Common fields
    "messageUpdatedData": {
        "previousMessage": {
            // ... Previous Message payload
        },
        "newMessage": {
            // ... New Message payload
        },
        "channelId": "cbc601f1-dec6-4594-9476-51628a17499a",
        "sourceId": "81310ae5-228e-438e-9720-35f737b9ca9f"
    }
}

See the full example of Message payload here

PostUpdatedData

The postUpdatedData object contains the following fields:

FieldTypeDescription
sourceIdStringThe Source identifier bound to the Post.
previousContentPostPrevious Post data.
newContentPostNew Post data.

Example:

{
    // ... Common fields
    "contentUpdatedData": {
        "previousContent": {
            // ... Previous Post payload
        },
        "newContent": {
            // ... New Post payload
        },
        "sourceId": "81310ae5-228e-438e-9720-35f737b9ca9f"
    }
}

See the full example of Post payload here

AuthorUpdatedData


The authorUpdatedData object contains the following fields:

FieldTypeDescription
sourceIdStringThe Source identifier bound to the Author.
previousAuthorAuthorPrevious Author data.
newAuthorAuthorNew Author data.

Example:

{
    // ... Common fields
    "authorUpdatedData": {
        "previousAuthor": {
            // ... Previous Author payload
        },
        "newAuthor": {
            // ... New Author payload
        }
    },
    "sourceId": "81310ae5-228e-438e-9720-35f737b9ca9f"
}

See the full example of Author payload here