Automations

Introduction

# Automations
GET https://api.ittybit.com/automations/:id
PATCH https://api.ittybit.com/automations/:id

Automations are a sequence of Tasks that can be run when a certain set of conditions is met. Use them to automate repetitive tasks or to manage large volumes of media.

For example, whenever a video is uploaded you can automate a sequence of Tasks to start:

  • Check whether the contents of a video is NSFW.

  • Generate lower resolution variants to accommodate various buffering conditions.

  • Transcribe audio and generate subtitles.

  • Generate a summary.

Endpoints

Create Automation

const response = await fetch(`https://api.ittybit.com/automations`, {
  headers: {
    Method: "POST",
    Authorization: `Bearer ${ITTYBIT_API_KEY}`,
    "Content-Type": "application/json",
    body: JSON.stringify({
	"name": "All video uploads",
	"trigger": {
		"event": "media.created",
		"conditions": [
			{"prop": "kind", "value": "video"}
		]
	},
	"tasks": [
		{
			"kind": "image",
			"start": 0
		}, {
			"kind": "video",
			"width": 600,
			"format": "mp4",
			"filename": "600.mp4",
			"next": [
				{
					"kind": "speech",
					"next": [
						{
							"kind": "subtitles"
						}
					]
				},
				{
					"kind": "thumbnails"
				}
			]
		}
	]
	 }),
  },
});

https://api.ittybit.com/automations

HTTP Method

POST

Description

Creates a new Automation and sets the trigger that sets it off and the Tasks to be executed.

Body Parameters

  • trigger object (required) An object that contains the event and conditions that set off the automation

    • event string
      • The event that the automation listens for.
    • conditions array
      • An array of objects that contain property-value pairs of the target event media that have to be met for the automation to set off.
  • tasks array (required) An array of Tasks to be executed once the event is detected and the conditions are met in the Trigger

  • name string A name for the automation.

List Automations

const response = await fetch(`https://api.ittybit.com/automations`, {
  headers: {
    Authorization: `Bearer ${ITTYBIT_API_KEY}`,
  },
});
curl "https://api.ittybit.com/automations"
-H "Authorization: Bearer ITTYBIT_API_KEY"

Endpoint

https://api.ittybit.com/automations

HTTP Method

GET

Description

Returns a list of all automations in your project.

Query Parameters

  • page integer

    The page number to return. Default is 1.

  • limit integer

    The number of items to return per page. Default is 12. Maximum is 100.

  • sort string

    The field to sort by. Default is created. Possible values are created or updated

  • order string

    The order to sort by. Default is desc. Possible values are asc, desc.