Skip to content

Commit 451cad2

Browse files
Merge pull request #135 from apivideo/add-new-webhooks
Add new webhooks
2 parents a4763d0 + 7e62296 commit 451cad2

File tree

9 files changed

+358
-78
lines changed

9 files changed

+358
-78
lines changed

api/openapi.yaml

Lines changed: 172 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14706,17 +14706,20 @@ paths:
1470614706
x-accepts: application/json
1470714707
post:
1470814708
description: "Webhooks can push notifications to your server, rather than polling\
14709-
\ api.video for changes. We currently offer four events: \n* ```video.encoding.quality.completed```\
14709+
\ api.video for changes. We currently offer four events: \n* `video.encoding.quality.completed`\
1471014710
\ Occurs when a new video is uploaded into your account, it will be encoded\
1471114711
\ into several different HLS and mp4 qualities. When each version is encoded,\
1471214712
\ your webhook will get a notification. It will look like ```{ \"type\":\
1471314713
\ \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\"\
1471414714
, \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"\
14715-
} ```. This request says that the 720p HLS encoding was completed.\n* ```live-stream.broadcast.started```\
14715+
} ```. This request says that the 720p HLS encoding was completed.\n* `live-stream.broadcast.started`\
1471614716
\ When a live stream begins broadcasting, the broadcasting parameter changes\
14717-
\ from false to true, and this webhook fires.\n* ```live-stream.broadcast.ended```\
14718-
\ This event fires when a live stream has finished broadcasting.\n* ```video.source.recorded```\
14719-
\ This event occurs when a live stream is recorded and submitted for encoding."
14717+
\ from false to true, and this webhook fires.\n* `live-stream.broadcast.ended`\
14718+
\ This event fires when a live stream has finished broadcasting.\n* `video.source.recorded`\
14719+
\ This event occurs when a live stream is recorded and submitted for encoding.\n\
14720+
* `video.caption.generated` This event occurs when an automatic caption has\
14721+
\ been generated.\n* `video.summary.generated` This event occurs when an\
14722+
\ automatic summary has been generated."
1472014723
operationId: POST-webhooks
1472114724
requestBody:
1472214725
content:
@@ -16362,6 +16365,13 @@ components:
1636216365
occur, the API triggers a webhook call to the URL you provided.
1636316366
example: '["video.encoding.quality.completed"]'
1636416367
items:
16368+
enum:
16369+
- live-stream.broadcast.started
16370+
- live-stream.broadcast.ended
16371+
- video.source.recorded
16372+
- video.encoding.quality.completed
16373+
- video.caption.generated
16374+
- video.summary.generated
1636516375
type: string
1636616376
type: array
1636716377
url:
@@ -17889,15 +17899,17 @@ components:
1788917899
url: http://clientnotificationserver.com/notif?myquery=query
1789017900
properties:
1789117901
events:
17892-
description: |-
17893-
A list of the webhooks that you are subscribing to. There are Currently four webhook options:
17894-
* ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"} ```. This request says that the 720p HLS encoding was completed.
17895-
* ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires.
17896-
* ```live-stream.broadcast.ended``` This event fires when a live stream has finished broadcasting.
17897-
* ```video.source.recorded``` Occurs when a live stream is recorded and submitted for encoding.
17902+
description: An array of webhook events that you want to subscribe to.
1789817903
example:
1789917904
- video.encoding.quality.completed
1790017905
items:
17906+
enum:
17907+
- live-stream.broadcast.started
17908+
- live-stream.broadcast.ended
17909+
- video.source.recorded
17910+
- video.encoding.quality.completed
17911+
- video.caption.generated
17912+
- video.summary.generated
1790117913
type: string
1790217914
type: array
1790317915
url:
@@ -18897,4 +18909,153 @@ x-webhooks:
1889718909
summary: Accepted
1889818910
description: Your webhook server may return this response to api.video to
1889918911
signal that the webhook is accepted.
18912+
video.caption.generated:
18913+
post:
18914+
tags:
18915+
- Webhooks
18916+
summary: Video caption generated
18917+
description: This webhook triggers when the API finishes generating a caption
18918+
for a video.
18919+
operationId: POST-webhooks
18920+
parameters:
18921+
- in: header
18922+
name: X-Api-Video-WebhookID
18923+
schema:
18924+
type: string
18925+
description: The unique ID of your webhook.
18926+
required: true
18927+
- in: header
18928+
name: X-Api-Video-Signature
18929+
schema:
18930+
type: string
18931+
description: The webhook's body encrypted using the webhook's signature secret,
18932+
in HMAC SHA256. Use this hash to verify that api.video is the origin of
18933+
this webhook notification.
18934+
required: true
18935+
requestBody:
18936+
content:
18937+
application/json:
18938+
schema:
18939+
type: object
18940+
properties:
18941+
type:
18942+
type: string
18943+
description: The name of the webhook event that occurred.
18944+
example: video.caption.generated
18945+
emittedAt:
18946+
description: Returns the date-time when the webhook event occurred.
18947+
type: string
18948+
format: date-time
18949+
example: 2024-08-151T10:18:47+00:00
18950+
videoId:
18951+
description: The ID of the video for which the caption was generated.
18952+
type: string
18953+
example: vi4blUQJFrYWbaG44NCh1234
18954+
captionId:
18955+
description: The ID of the caption that was generated.
18956+
type: string
18957+
example: caption_1CHAfLFHT5B5EV4vzT1234
18958+
generationMode:
18959+
description: Returns the method used to generate the caption. `transcript`
18960+
means that the caption was generated based on the transcription
18961+
of the video. Learn more about transcripts [here](https://docs.api.video/vod/generate-transcripts).
18962+
type: string
18963+
enum:
18964+
- transcript
18965+
example: transcript
18966+
language:
18967+
description: Returns the language of the captions in [IETF language
18968+
tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
18969+
example: en
18970+
type: string
18971+
enum:
18972+
- ar
18973+
- ca
18974+
- cs
18975+
- da
18976+
- de
18977+
- el
18978+
- en
18979+
- es
18980+
- fa
18981+
- fi
18982+
- fr
18983+
- he
18984+
- hi
18985+
- hr
18986+
- hu
18987+
- it
18988+
- ja
18989+
- ko
18990+
- ml
18991+
- nl
18992+
- nn
18993+
- false
18994+
- pl
18995+
- pt
18996+
- ru
18997+
- sk
18998+
- sl
18999+
- te
19000+
- tr
19001+
- uk
19002+
- ur
19003+
- vi
19004+
- zh
19005+
responses:
19006+
"202":
19007+
summary: Accepted
19008+
description: Your webhook server may return this response to api.video to
19009+
signal that the webhook is accepted.
19010+
video.summary.generated:
19011+
post:
19012+
tags:
19013+
- Webhooks
19014+
summary: Video summary generated
19015+
description: This webhook triggers when the API finishes generating a summary
19016+
for a video.
19017+
operationId: POST-webhooks
19018+
parameters:
19019+
- in: header
19020+
name: X-Api-Video-WebhookID
19021+
schema:
19022+
type: string
19023+
description: The unique ID of your webhook.
19024+
required: true
19025+
- in: header
19026+
name: X-Api-Video-Signature
19027+
schema:
19028+
type: string
19029+
description: The webhook's body encrypted using the webhook's signature secret,
19030+
in HMAC SHA256. Use this hash to verify that api.video is the origin of
19031+
this webhook notification.
19032+
required: true
19033+
requestBody:
19034+
content:
19035+
application/json:
19036+
schema:
19037+
type: object
19038+
properties:
19039+
type:
19040+
type: string
19041+
description: The name of the webhook event that occurred.
19042+
example: video.caption.generated
19043+
emittedAt:
19044+
description: Returns the date-time when the webhook event occurred.
19045+
type: string
19046+
format: date-time
19047+
example: 2024-08-151T10:18:47+00:00
19048+
videoId:
19049+
description: The ID of the video for which the summary was generated.
19050+
type: string
19051+
example: vi4blUQJFrYWbaG44NCh1234
19052+
summaryId:
19053+
description: The ID of the summary that was generated.
19054+
type: string
19055+
example: summary_1CGyYoB9XCgBk4iQna8ocT
19056+
responses:
19057+
"202":
19058+
summary: Accepted
19059+
description: Your webhook server may return this response to api.video to
19060+
signal that the webhook is accepted.
1890019061

docs/Webhook.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,24 @@ Name | Type | Description | Notes
88
------------ | ------------- | ------------- | -------------
99
**webhookId** | **String** | A unique identifier of the webhook you subscribed to. | [optional]
1010
**createdAt** | **OffsetDateTime** | The time and date when you created this webhook subscription, in ATOM UTC format. | [optional]
11-
**events** | **List<String>** | A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you provided. | [optional]
11+
**events** | [**List<EventsEnum>**](#List<EventsEnum>) | A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you provided. | [optional]
1212
**url** | **String** | The URL where the API sends the webhook. | [optional]
1313
**signatureSecret** | **String** | A secret key for the webhook you subscribed to. You can use it to verify the origin of the webhook call that you receive. | [optional]
1414

1515

16+
17+
## Enum: List<EventsEnum>
18+
19+
Name | Value
20+
---- | -----
21+
LIVE_STREAM_BROADCAST_STARTED | "live-stream.broadcast.started"
22+
LIVE_STREAM_BROADCAST_ENDED | "live-stream.broadcast.ended"
23+
VIDEO_SOURCE_RECORDED | "video.source.recorded"
24+
VIDEO_ENCODING_QUALITY_COMPLETED | "video.encoding.quality.completed"
25+
VIDEO_CAPTION_GENERATED | "video.caption.generated"
26+
VIDEO_SUMMARY_GENERATED | "video.summary.generated"
27+
28+
1629
## Implemented Interfaces
1730

1831
* Serializable

docs/WebhooksApi.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Method | HTTP request | Description
1818
1919
Create Webhook
2020

21-
Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer four events: * ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"} ```. This request says that the 720p HLS encoding was completed. * ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * ```live-stream.broadcast.ended``` This event fires when a live stream has finished broadcasting. * ```video.source.recorded``` This event occurs when a live stream is recorded and submitted for encoding.
21+
Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer four events: * `video.encoding.quality.completed` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"} ```. This request says that the 720p HLS encoding was completed. * `live-stream.broadcast.started` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * `live-stream.broadcast.ended` This event fires when a live stream has finished broadcasting. * `video.source.recorded` This event occurs when a live stream is recorded and submitted for encoding. * `video.caption.generated` This event occurs when an automatic caption has been generated. * `video.summary.generated` This event occurs when an automatic summary has been generated.
2222

2323
### Example
2424
```java
@@ -38,11 +38,7 @@ public class Example {
3838
WebhooksApi apiInstance = client.webhooks();
3939

4040
WebhooksCreationPayload webhooksCreationPayload = new WebhooksCreationPayload(); //
41-
webhooksCreationPayload.setEvents(Arrays.asList("video.encoding.quality.completed")); // A list of the webhooks that you are subscribing to. There are Currently four webhook options:
42-
* ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"} ```. This request says that the 720p HLS encoding was completed.
43-
* ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires.
44-
* ```live-stream.broadcast.ended``` This event fires when a live stream has finished broadcasting.
45-
* ```video.source.recorded``` Occurs when a live stream is recorded and submitted for encoding.
41+
webhooksCreationPayload.setEvents(Arrays.asList("video.encoding.quality.completed")); // An array of webhook events that you want to subscribe to.
4642
webhooksCreationPayload.setUrl("https://example.com/webhooks"); // The the url to which HTTP notifications are sent. It could be any http or https URL.
4743

4844

docs/WebhooksCreationPayload.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,23 @@
66

77
Name | Type | Description | Notes
88
------------ | ------------- | ------------- | -------------
9-
**events** | **List<String>** | A list of the webhooks that you are subscribing to. There are Currently four webhook options: * ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \\\"type\\\": \\\"video.encoding.quality.completed\\\", \\\"emittedAt\\\": \\\"2021-01-29T16:46:25.217+01:00\\\", \\\"videoId\\\": \\\"viXXXXXXXX\\\", \\\"encoding\\\": \\\"hls\\\", \\\"quality\\\": \\\"720p\\\"} ```. This request says that the 720p HLS encoding was completed. * ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * ```live-stream.broadcast.ended``` This event fires when a live stream has finished broadcasting. * ```video.source.recorded``` Occurs when a live stream is recorded and submitted for encoding. |
9+
**events** | [**List<EventsEnum>**](#List<EventsEnum>) | An array of webhook events that you want to subscribe to. |
1010
**url** | **String** | The the url to which HTTP notifications are sent. It could be any http or https URL. |
1111

1212

13+
14+
## Enum: List<EventsEnum>
15+
16+
Name | Value
17+
---- | -----
18+
LIVE_STREAM_BROADCAST_STARTED | "live-stream.broadcast.started"
19+
LIVE_STREAM_BROADCAST_ENDED | "live-stream.broadcast.ended"
20+
VIDEO_SOURCE_RECORDED | "video.source.recorded"
21+
VIDEO_ENCODING_QUALITY_COMPLETED | "video.encoding.quality.completed"
22+
VIDEO_CAPTION_GENERATED | "video.caption.generated"
23+
VIDEO_SUMMARY_GENERATED | "video.summary.generated"
24+
25+
1326
## Implemented Interfaces
1427

1528
* Serializable

0 commit comments

Comments
 (0)