Hooks

Hooks

Use hooks to trigger actions when certain events happen. We currently support only a limited number but can add more. Simply get in touch.

The triggered action runs on a service and so you will need to have at least one service before creating a hook.

You can manage your hooks by making the following requests:

Return the details of all of the hooks in your account
GET /hooks

Example request

curl \
-H "Authorization: Bearer YOUR-API-KEY" \
"https://api.vidbeo.com/v2/hooks"

Example response

{
"success": true,
"result": [
{
"id": "abcde12345abcde12345a",
"name": "Copy video to YouTube",
"event": "video.created",
"filters": [],
"filters_logic": "and",
"service": "abcde12345abcde12345a",
"action": "videos.insert",
"params": [],
"created_by": "abcde12345abcde12345a",
"created_time": "2022-01-01T00:00:00.000Z",
"updated_by": "abcde12345abcde12345a",
"updated_time": "2022-01-01T00:00:00.000Z"
}
],
"links": {},
"errors": []
}

Optional parameters (query string)

NameTypeDefaultInformation
limitString25Maximum number to return
cursorString""Used to get the next page of results: if applicable we return this as part of the links.next URL
Return the details of a single hook
GET /hooks/:id

Example request

curl \
-H "Authorization: Bearer YOUR-API-KEY" \
"https://api.vidbeo.com/v2/hooks/abcde12345abcde12345a"

Example response

{
"success": true,
"result": {
"id": "abcde12345abcde12345a",
"name": "Copy video to YouTube",
"event": "video.created",
"filters": [],
"filters_logic": "and",
"service": "abcde12345abcde12345a",
"action": "videos.insert",
"params": [],
"created_by": "abcde12345abcde12345a",
"created_time": "2022-01-01T00:00:00.000Z",
"updated_by": "abcde12345abcde12345a",
"updated_time": "2022-01-01T00:00:00.000Z"
},
"links": null,
"errors": []
}

Response format

KeyTypeDescription
idStringThe unique identifier given to this hook
nameStringThe name of this hook (a short label for it)
eventStringThe event that triggers the action. We currently only support "video.created"
filtersArrayAn array of objects. If empty, every event will trigger the action. However filters can be used to limit when the action triggers. Each object should be structured like {field: "id", operator:"eq", value: "abcde12345abcde12345a"}. The value of field is one taken from the event data. Contact us if interested in using these
filters_logicStringApplicable only when multiple filters have been specified: either "and" or "or"
serviceStringThe ID of the service the action will be performed using (see documentation for services)
actionStringThe action that will be triggered using the service. We currently only support "videos.insert"
paramsArrayAny additional data sent along with the action/request: this holds an array of objects like {field: "", value: ""}. The supported fields depends on the action. For example params could be used to store a Mailchimp list ID so that the action knows which marketing list a submitted email address should be added to
created_byStringThe ID of the user who created it (if known)
created_timeStringThe date and time it was created
updated_byStringThe ID of the user who last modified it (if known)
updated_timeStringThe date and time it was last modified
Update a hook
PATCH /hooks/:id

The body of the request should contain one, or more, attributes that you would like to update for the hook.

Example request

curl \
-g \
-H "Authorization: Bearer YOUR-API-KEY" \
-H "Content-Type: application/json" \
-X PATCH \
-d '{"name":"New name"}' \
"https://api.vidbeo.com/v2/hooks/abcde12345abcde12345a"

Example response

{
"success": true,
"result": {
"id": "abcde12345abcde12345a",
"name": "New name",
"event": "video.created",
"filters": [],
"filters_logic": "and",
"service": "abcde12345abcde12345a",
"action": "videos.insert",
"params": [],
"created_by": "abcde12345abcde12345a",
"created_time": "2022-01-01T00:00:00.000Z",
"updated_by": "abcde12345abcde12345a",
"updated_time": "2022-01-01T00:00:00.000Z"
},
"links": null,
"errors": []
}
Delete a hook
DELETE /hooks/:id

Example request

curl \
-H "Authorization: Bearer YOUR-API-KEY" \
-X DELETE \
"https://api.vidbeo.com/v2/hooks/abcde12345abcde12345a"

Example response

{
"success": true,
"result": {},
"links": null,
"errors": []
}
Create a hook
POST /hooks

Required parameters

Its name, an event, a service, and an action to run on that service.

KeyTypeDescription
nameStringThe name of the hook (1-40 characters)
eventStringThe event that triggers the action. We currently only support "video.created"
serviceStringThe ID of the service the action will be performed using. See the documentation for services
actionStringThe action that will be triggered using the service. We currently only support "videos.insert"

Example request

curl \
-g \
-H "Authorization: Bearer YOUR-API-KEY" \
-H "Content-Type: application/json" \
-X POST \
-d '{"name":"Copy video to YouTube","event":"video.created","service":"abcde12345abcde12345a","action":"videos.insert"}' \
"https://api.vidbeo.com/v2/hooks"

Example response

{
"success": true,
"result": {
"id": "abcde12345abcde12345a",
"name": "Copy video to YouTube",
"event": "video.created",
"filters": [],
"filters_logic": "and",
"service": "abcde12345abcde12345a",
"action": "videos.insert",
"params": [],
"created_by": "abcde12345abcde12345a",
"created_time": "2022-01-01T00:00:00.000Z",
"updated_by": "abcde12345abcde12345a",
"updated_time": "2022-01-01T00:00:00.000Z"
},
"links": null,
"errors": []
}