All Collections
Platform Documentation
Settings module: Webhooks
Settings module: Webhooks

Here's how to use this Platform feature

Miguel Giraldo avatar
Written by Miguel Giraldo
Updated over a week ago

Platform allows you to configure webhooks to send notifications to a specified URL, so that you can receive events of changes made to your account content in real time, automatically updating your site, these notifications are delivered through a JSON with the model of the entity that is being listened to, after creating a POST endpoint.

In platform, there are several elements that can be modified by the account users, and the APi is used to view or call the changes made.

These webhooks are configured as follows

  • Go to the Settings / Webhooks module.

  • Click on the Create new Webhook button.

  • A pop-up opens in which you can enter the name to identify your webhook, the endpoint URL that will receive the notifications and finally, you can select the modules on which you want to receive these notifications, all of them have 3 types of notice each, Create-Update-Delete, at the end save the changes you have made.

The webhook notifies the actions made on the following entities in platform:

  • Access restrictions

  • Item

  • Category

  • Customer

  • Profile

  • Buy

  • Live

  • Schedule

  • ScheduleWork

  • Media

  • Moment

  • Playlist

  • Product

  • Payment

  • SeasonEpisode

  • Show

  • ShowRelated

  • ShowSeason

The structure for each model is dynamic and changes according to the type of query and entity, such structure follows the following parameter: type: #{model}#{action} data: {...}

Customer Update Example:

{ type: "customers.update",
data: {
account: "{accountID}",
email: "email@test.com",
{ id: "83560924817634561".
... }
}

Once configured, you will see it inside the module as shown in the image:

You can activate or deactivate it, edit or delete it as you need, using the buttons on the right side of each webhook..

The webhooks in platform have a limit of up to 3 urls to receive notifications, any additional updates must be requested through your salesperson in charge.


New on platform

Secret Token:

This new feature available in the module allows the user using the webhooks to implement a secret token that helps validate that requests are coming from Mediastream Platform and not from a third party to their endpoints.

When creating a new webhook, or editing a pre-configured webhook, a Secret Token box will now appear on which you can enter a random word or sequence of characters.

This will generate a signature in sha-256 algorithm that will contain the following data:

  • Type of webhook

  • Document ID

  • Date of signature

  • Secret key

type=<webhook_type>~id=<document_id>~date=<signature_date>~key=<secret_key>

Displayed in hexadecimal format, the signature is sent in the body of the webhook along with the information required for client validation, if the configuration was done correctly, inside the webhook you will see the following:

{
“type”: “media.update”,
“data”: {
“_id”: “61d4cf6c0f124264a0118b3e”

},
“date”: 1648734415606
“signature”: “fb587dbd320f690d67aca507b1e12ec1152d49c6ade1c9745863c98348b9a51”
}

With the above example the sha-256 signature would look as follows:

type=media.update~id=61d4cf6c0f124264a0118b3e~date=1648734415606~key=fb587dbd320f690d67aca507b1e12ec1152d49c6ade1c9745863c98348b9a51

When doing sha-256 with a hexadecimal format, the signature obtained must be equal to the one Platform sends in the signature field, indicating that the hook is valid.


If you have any related question, please, feel free to write to us.

Atte. Mediastream team

Did this answer your question?