Como configurar uma notificação webhook?

É possível configurar um webhook para receber notificações quando uma mídia é adicionada, atualizada ou deletada.

Para fazer essa configuração, siga os passos abaixo:

 

1) Vá até o menu de configurações do projeto;

2) Clique no menu de Webhook;

3) Defina o endpoint que irá receber a mídia;

4) Defina quais as notificações serão enviadas (atualizações, deleções ou inserções de mídias);

5) Salve as alterações.

pasted image 0-7

Você poderá definir se a notificação será em formato XML ou JSON (figura 1) e, também, testar o endpoint (figura 2).

pasted image 0 (1)-5

Exemplos de notificações do webhook

Update em formato JSON:

{

   "operation": "UPDATE",

   "media": {

      "id": "11a1a11a11111a11111a11a11111a111",

      "title": "novo vídeo",

      "status": "ACTIVE",

      "qualifier": "VIDEO",

      "fileName": null,

      "description": null,

      "shortDescription": null,

      "categoryName": "111",

      "categoryId": 410,

      "postdate": 1567690423000,

      "lastModified": 1568835843773,

      "publishDate": 1568835780000,

      "unpublishDate": null,

      "published": true,

      "highlighted": false,

      "restricted": false,

      "secondUrl": null,

      "numberOfViews": 0,

      "numberOfComments": 0,

      "numberOfRatings": 0,

      "childStatus": "ACTIVE",

      "blocked": false,

      "processingChange": null,

      "tags": [],

      "files": [

         {

            "id": "11a1a11a11111a11111a11a11111a111",

            "qualifier": "VIDEO",

            "fileName": "video_teste",

            "fileSize": "383631",

            "status": "ACTIVE",

            "postdate": 1567690426000,

            "mimeType": null,

            "outputName": "_RAW",

            "outputId": 0,

            "url": "http://pvbps-sambavideos.cdn.net/account/111/111/2019-09-05/video/11a1a11a11111a11111a11a11111a111/video_teste",

            "md5": null,

            "assetId": null,

            "assetName": null,

            "container": null,

            "fileInfo": {

               "duration": 5555,

               "bitrate": 777777,

               "framerate": 88,

               "width": 555,

               "height": 333,

               "videoCodec": "h222",

               "audioCodec": "aac",

               "audioChannels": 1,

               "audioSampleRate": 44444

            },

            "fileInfoType": "VIDEO"

         },

         {

            "id": "11a1a11a11111a11111a11a11111a111",

            "qualifier": "VIDEO",

            "fileName": "11a1a11a11111a11111a11a11111a111",

            "fileSize": "111111",

            "status": "ACTIVE",

            "postdate": 1567690515000,

            "mimeType": null,

            "outputName": "240p",

            "outputId": 10000,

            "url": "http://pvbps-sambavideos.cdn.net/account/111/111/2019-09-05/video/11a1a11a11111a11111a11a11111a111/11a1a11a11111a11111a11a11111a111_240p.mp4",

            "md5": "11a1a11a11111a11111a11a11111a111",

            "assetId": null,

            "assetName": null,

            "container": null,

            "fileInfo": {

               "duration": 5000,

               "bitrate": 193536,

               "framerate": 30,

               "width": 420,

               "height": 240,

               "videoCodec": "h222",

               "audioCodec": "aac",

               "audioChannels": 2,

               "audioSampleRate": 44444

            },

            "fileInfoType": "VIDEO"

         }

      ],

      "thumbs": [

         {

            "height": 120,

            "size": 5717,

            "width": 213,

            "url": "http://pvbps-sambavideos.cdn.net/account/111/111/2019-09-05/thumbnail/11a1a11a11111a11111a11a11111a111/11a1a11a11111a11111a11a11111a111_213x120_50_0.jpg",

            "status": "ACTIVE"

         },

         {

            "height": 240,

            "size": 12653,

            "width": 427,

            "url": "http://pvbps-sambavideos.cdn.net/account/111/111/2019-09-05/thumbnail/11a1a11a11111a11111a11a11111a111/11a1a11a11111a11111a11a11111a111_427x240_50_0.jpg",

            "status": "ACTIVE"

         },

         {

            "height": 480,

            "size": 22840,

            "width": 853,

            "url": "http://pvbps-sambavideos.cdn.net/account/111/111/2019-09-05/thumbnail/11a1a11a11111a11111a11a11111a111/11a1a11a11111a11111a11a11111a111_853x480_50_0.jpg",

            "status": "ACTIVE"

         }

      ],

      "genders": [],

      "captions": [],

      "externalPublishings": [],

      "libras": {

         "enabled": false

      },

      "liveChannelId": null,

      "sambaLiveChannelId": null,

      "blockedsSet": true

   }

}

 

Insert em formato XML:

<?xml version="1.0" encoding="UTF-8"?><MediaEvent><EventType>INSERT</EventType><Media><IdMedia>11a1a11a11111a11111a11a11111a111</IdMedia><Title>video_teste</Title></Media></MediaEvent>

CTA_blog-01