Webhooks
Table of contents
To add and manage webhooks at an organization level, navigate to your Profile → Webhooks, or you can go directly to the page at this URL when logged in: https://app.flowplayer.com/organization/webhooks.
Whenever an event occurs in Flowplayer, it can be reported via a POST https request to your designated URL. You can build one or multiple webhooks for an organization, depending on the kind of events you want to track and on the conditions you want to set up.
In a single webhook configuration, you are able track multiple types of events and create compound conditions. It is possible to create a configuration triggered only by certain event types, but with no other compound conditions.
If you are new to webhooks, check out this comprehensive guide to working with webhooks.
Verifying Webhooks
To verify webhook requests, generate a HMAC-SHA256 hexdigest
of the request body using the organization Webhooks Secret Key (will be set in the UI) as a secret, then compare it with the hexdigest we sent in the request header X-FP-Webhook-Signature-Hmac-Sha-256
. That way, you will be sure Flowplayer sent the webhook notification.
If no Webhooks Secret Key is saved, then no events will be triggered for your organization.
Payload of the HTTP POST request
The HTTP POST request Flowplayer to be sent to the organization designated URL will be transmitted in JSON format (Content-Type: application/json
) and the request body will contain:
event_type
: The type of the triggered event in the Flowplayer platform- Can have the following values:
ALL
- will match any type of event in one configuration,VIDEO_READY
- a video is ready to be played, after encoding finished in success,VIDEO_UPDATED
,VIDEO_DELETED
,LIVESTREAM_CREATED
,LIVESTREAM_UPDATED
,LIVESTREAM_DELETED
,LIVESTREAM_CONNECTED
,LIVESTREAM_DISCONNECTED
,LIVESTREAM_ERROR
,PLAYLIST_CREATED
,PLAYLIST_UPDATED
,PLAYLIST_DELETED
,LIVESOURCE_CREATED
,LIVESOURCE_UPDATED
,LIVESOURCE_DELETED
,LIVESOURCE_CONNECTED
,LIVESOURCE_DISCONNECTED
- Can have the following values:
event_id
: The ID that was assigned to the event- eg:
586e6c08-c922-11eb-927e-fb8c8a3c5071
- eg:
created_at
: The timestamp of the event when it was triggered, in UTC timezone, formatyyyy-MM-dd'T'HH:mm:ssZ
- eg:
2021-06-09T12:58:49Z
- eg:
payload
: The event's payload containing all the information about the event, all different events described below.
VIDEO_READY, VIDEO_UPDATED
The payload
will be transmitted in JSON format with the same structure as API v3 has for Get video
Example:
{
"event_type": "VIDEO_UPDATED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload": {
"name": "My video",
"description": "string",
"duration": 0,
"unpublish": false,
"unpublish_date": "2020-01-01T12:33:22+00:00",
"published": true,
"publish_date": "2020-01-01T12:33:22+00:00",
"tags": "for,bar",
"remote": false,
"custom_fields": [
{}
],
"category": {
"id": "string",
"name": "string"
},
"category_id": "<The Workspace default Category>",
"no_ads": true,
"ad_keywords": "special_ads",
"workspace": {
"id": "string",
"name": "string"
},
"user_id": "string",
"id": "9aaaaa9a-1234-56bc-789d-8eeeeee765",
"created_at": "2020-01-01T12:33:22+00:00",
"updated_at": "2020-01-01T12:33:22+00:00",
"state": "FINISHED",
"encoding_progress": 0,
"upload_progress": 0,
"error_message": "string",
"deactivated": false,
"images": [
{}
],
"encodings": [
{}
],
"subtitles": [
{}
],
"drm": {
"com.widevine.alpha": {},
"com.apple.fps.1_0": {},
"com.microsoft.playready": {}
},
"shallow_copy": true,
"multiple_audio_tracks": true,
"audio_only": true,
"upload_type": "WEB_BASED_UI",
"version": 0
}
}
VIDEO_DELETED
The payload
will have the following JSON format:
id
: The video IDsuccess
: If the removal was successful
Example:
{
"event_type": "VIDEO_DELETED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload" : {
"id": "08b4c5f2-c924-11eb-962f-77c0d275dedb",
"success": "ok"
}
}
PLAYLIST_CREATED, PLAYLIST_UPDATED
The payload
will be transmitted in JSON format with the same structure as API v3 has for Get playlist
Example:
{
"event_type": "PLAYLIST_CREATED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload": {
"name": "My playlist",
"description": "string",
"config": {
"include": {},
"exclude": {},
"limit": 0,
"ordering": "NAME_A_Z"
},
"type": "MANUAL",
"workspace": {
"id": "cb65a918-ad7d-406a-80d8-09c9c8d0dbbd",
"name": "My Workspace"
},
"id": "9aaaaa9a-1234-56bc-789d-8eeeeee765",
"items": [
{}
],
"created_at": "string",
"updated_at": "string"
}
}
PLAYLIST_DELETED
The payload
will have the following JSON format:
id
: The playlist IDsuccess
: If the removal was successful
Example:
{
"event_type": "PLAYLIST_DELETED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload" : {
"id": "08b4c5f2-c924-11eb-962f-77c0d275dedb",
"success": "ok"
}
}
LIVESTREAM_CREATED, LIVESTREAM_UPDATED
The payload
will be transmitted in JSON format with the same structure as API v3 has for Get livestream
Example:
{
"event_type": "LIVESTREAM_CREATED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload": {
"name": "My first Livestream",
"description": "Description of my first Livestream",
"remote": true,
"video": {
"video_id": "replacing_video_id",
"display_video": false
},
"start_time": "2021-01-01T12:00:00Z",
"stop_time": "2021-01-01T13:00:00Z",
"category_id": "string",
"scheduling_type": "INSTANT",
"record": {
"record": true,
"auto_replace_with_recording": true
},
"custom_fields": [
{}
],
"ad_keywords": "Special ads",
"no_ads": true,
"published": true,
"tags": "foo,bar",
"allow_playback_after_stop_time": true,
"id": "cb65a918-ad7d-406a-80d8-09c9c8d0dbbd",
"created_at": "2021-01-01T12:33:22Z",
"updated_at": "2021-01-01T12:33:22Z",
"images": [
{}
],
"workspace": {
"id": "cb65a918-ad7d-406a-80d8-09c9c8d0dbbd",
"name": "My Workspace"
},
"live_source": {
"name": "string",
"description": "Description of my first Live source",
"type": "REMOTE",
"remote_hls_url": "https://external.example.com/playlist.m3u8",
"workspaces": [],
"owner": {},
"id": "string"
},
"user_id": "string",
"category": {
"name": "My first Category",
"description": "This is a Category description",
"parent_id": "cb65a918-ad7d-406a-80d8-09c9c8d0dbb",
"workspace": {},
"id": "cb65a918-ad7d-406a-80d8-09c9c8d0dbbd"
},
"stream": {
"viewing_url": "https://cdn.flowplayer.com/hls/livestream.m3u8",
"quality_type": "RES1080PASS",
"dvr": false
},
"simulive_playlist": [
{}
]
}
}
LIVESTREAM_DELETED
The payload
will have the following JSON format:
id
: The scheduled slot IDsuccess
: If the removal was successful
Example:
{
"event_type": "LIVESTREAM_DELETED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload" : {
"id": "08b4c5f2-c924-11eb-962f-77c0d275dedb",
"success": "ok"
}
}
LIVESTREAM_CONNECTED, LIVESTREAM_DISCONNECTED
Whenever a livestream gets connected/disconnected. The payload
will be transmitted in JSON format with the same structure as API v3 has for Get livestream
Example:
{
"event_type": "LIVESTREAM_CONNECTED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload": {
"name": "Livestream that was connected",
"description": "Description of my first Livestream",
"remote": true,
"video": {
"video_id": "replacing_video_id",
"display_video": false
},
"start_time": "2021-01-01T12:00:00Z",
"stop_time": "2021-01-01T13:00:00Z",
"category_id": "string",
"scheduling_type": "INSTANT",
"record": {
"record": true,
"auto_replace_with_recording": true
},
"custom_fields": [
{}
],
"ad_keywords": "Special ads",
"no_ads": true,
"published": true,
"tags": "foo,bar",
"allow_playback_after_stop_time": true,
"id": "cb65a918-ad7d-406a-80d8-09c9c8d0dbbd",
"created_at": "2021-01-01T12:33:22Z",
"updated_at": "2021-01-01T12:33:22Z",
"images": [
{}
],
"workspace": {
"id": "cb65a918-ad7d-406a-80d8-09c9c8d0dbbd",
"name": "My Workspace"
},
"live_source": {
"name": "string",
"description": "Description of my first Live source",
"type": "REMOTE",
"remote_hls_url": "https://external.example.com/playlist.m3u8",
"workspaces": [],
"owner": {},
"id": "string"
},
"user_id": "string",
"category": {
"name": "My first Category",
"description": "This is a Category description",
"parent_id": "cb65a918-ad7d-406a-80d8-09c9c8d0dbb",
"workspace": {},
"id": "cb65a918-ad7d-406a-80d8-09c9c8d0dbbd"
},
"stream": {
"viewing_url": "https://cdn.flowplayer.com/hls/livestream.m3u8",
"quality_type": "RES1080PASS",
"dvr": false
},
"simulive_playlist": [
{}
]
}
}
LIVESOURCE_CREATED, LIVESOURCE_UPDATED
The payload
will be transmitted in JSON format with the same structure as API v3 has for Get livesource
Example:
{
"event_type": "LIVESOURCE_CREATED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload": {
"name": "string",
"description": "Description of my first Live source",
"type": "REMOTE",
"remote_hls_url": "https://external.example.com/playlist.m3u8",
"workspaces": [
{}
],
"owner": {
"id": "cb65a918-ad7d-406a-80d8-09c9c8d0dbbd",
"name": "My Workspace"
},
"id": "string"
}
}
LIVESTREAM_ERROR
The payload
will be transmitted in following JSON format:
epoch_time_of_event
: The epoch value of the time of when the livestream error occurredtype
: The type of the error, possible values are:low_input_bitrate
,no_input_bitrate
,bad_key_frame_rate
,bad_frame_rate
,timecode_stopped
,timecode_non_montonic
,video_and_audio_too_far_apart
json
: A json string describing the livestream error
Example:
{
"event_type": "LIVESTREAM_ERROR",
"event_id": "f8cde5af-3665-476a-a539-54b83424dc84",
"created_at": "2021-08-16T09:01:11+0000",
"payload": {
"epoch_time_of_event": 1569324855910,
"type": "no_input_bitrate",
"json": "{\n \"attributes\": {\n \"slot_id\": \"694f05bf-8bf0-45e5-b00b-7ab84eeda5fb\",\n \"event_duration\": 0,\n \"epoch_start\": 1569324855910,\n \"epoch_end\": 1569324855910,\n \"count\": 1,\n \"incident_number\": 0,\n \"type\": \"no_input_bitrate_0\",\n \"expiration_time\": 1570620855,\n \"stream_name\": \"stream_name\",\n \"site_id\": \"992676f9-b420-4ff5-ba88-bfc69566211b\",\n \"site_group_id\": \"83f9b613-c7c9-4003-bf29-2a7967d2668e\",\n \"num_zero_records\": 8,\n \"min_elapsed_time\": 1122866.67,\n \"approx_arrival_time\": \"2019-09-24 11:34:05.910\"\n }\n}"
}
}
LIVESOURCE_DELETED
The payload
will have the following JSON format:
id
: The live source IDsuccess
: If the removal was successful
Example:
{
"event_type": "LIVESOURCE_DELETED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload" : {
"id": "08b4c5f2-c924-11eb-962f-77c0d275dedb",
"success": "ok"
}
}
LIVESOURCE_CONNECTED, LIVESOURCE_DISCONNECTED
The payload
will have the following JSON format:
id
: The live source IDstatus
:CONNECTED
/DISCONNECTED
Example 1:
{
"event_type": "LIVESOURCE_CONNECTED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload" : {
"id": "08b4c5f2-c924-11eb-962f-77c0d275dedb",
"status": "CONNECTED"
}
}
Example 2:
{
"event_type": "LIVESOURCE_DISCONNECTED",
"event_id": "586e6c08-c922-11eb-927e-fb8c8a3c5071",
"created_at": "2021-06-09T12:58:49Z",
"payload" : {
"id": "08b4c5f2-c924-11eb-962f-77c0d275dedb",
"status": "DISCONNECTED"
}
}