Creating automated content
Creating automated content using the CreateTOTALLY API can be done using the following flow:
- Create an automation asset
- Query the automation asset for available modifications
- Create an automation job with your required modifications
For the smoothest integration, we recommend using the below queries and mutations in conjunction with webhooks.
See webhooks for full details of how to subscribe to webhook events.
Creating an automation asset
You can create an automation asset by using the createAutomationAsset mutation and providing a URL
to the source file.
The file must be a publicly accessible file, such as a pre-signed URL.
Example
mutation Mutation($data: CreateAutomationAssetData!) {
createAutomationAsset(data: $data) {
id
}
}
Variables
{
"data": {
"source": [
{
"type": "FILE",
"input": "https://test-bucket.s3.eu-west-1.amazonaws.com/After_Effects_Collect_V01.zip"
}
],
"triggerAnalysis": true
}
}
Without the triggerAnalysis: true flag, analysisJobs have to be triggered manually using createAnalysisJob.
Example response
{
"data": {
"createAutomationAsset": {
"id": "2q_ox8e_Qz5qcFrW5Fw3Z"
}
}
}
This will attempt to upload the file from the source to CreateTOTALLY and send it for analysis.
When triggerAnalysis: true is provided, the analysis-job-completed webhook will be sent if successful.
Example
{
"analysisJob": {
"id": "G_RpaIBkQwzkDrZVtBw96",
"status": "completed",
"automationAsset": {
"id": "2q_ox8e_Qz5qcFrW5Fw3Z",
},
}
}
From here, you can query the automation asset for availableModificaitons.
Querying the automation asset
You can query automationAssets at any time. Once the processingStatus is COMPLETED, you should see
an array of availableModifications.
Example query
query AutomationAssets($where: WhereAssetAutomationAsset) {
automationAssets(where: $where) {
records {
id
processingStatus
filename
availableModifications {
compositionName
type
layerName
defaultValue
masterCompName
position {
x
y
}
}
}
}
}
Variables
{
"where": {
"id": {
"in": ["2q_ox8e_Qz5qcFrW5Fw3Z"]
}
}
}
Example response
{
"data": {
"automationAssets": {
"records": [
{
"id": "_IZAHR8u1ku5f5qOKYETv",
"processingStatus": "COMPLETED",
"filename": "After_Effects_Collect_V01.zip",
"availableModifications": [
{
"compositionName": "comp1",
"type": "TEXT",
"layerName": "HELLO",
"defaultValue": "HELLO",
"masterCompName": "02_main",
"position": {
"x": "960.0000038743",
"y": "538.31499542296"
}
},
{
"compositionName": "comp2",
"type": "TEXT",
"layerName": "WORLD",
"defaultValue": "WORLD",
"masterCompName": "02_main",
"position": {
"x": "960.00000250339",
"y": "541.30949783325"
}
},
]
}
]
}
}
}
You can use these availableModificaions when requesting automation.
Creating an automation job
You can create an automation job by using the createAutomationJob mutation and providing the automation asset id.
This will attempt to generate the new content based on the provided modifications.
Webhooks will be sent on success or failure.
The languageCode must be provided in ISO 639-2 format.
Example
mutation CreateAutomationJob($data: CreateAutomationJobData!) {
createAutomationJob(data: $data) {
id
}
}
Variables
{
"data": {
"automationAssetId": "2q_ox8e_Qz5qcFrW5Fw3Z",
"externalId": "your-system-id",
"languageCode": "eng",
"modifications": [
{
"compositionName": "comp1",
"type": "TEXT",
"layerName": "HELLO",
"value": "NEW WORLD",
"font": "Helvetica"
}
]
}
}
This will return a new automation job id for you to use in subsequent requests.
Example response
{
"data": {
"createAutomationJob": {
"id": "1z_oy8e_Qz8qcFrW5Fw2W"
}
}
}
Querying the automation job
You can query automationJobs at any time. Once the friendlyStatus is COMPLETE, you should see an array of generatedAssets.
Each generated asset contains a url property which is a signed URL.
Example query
query($where: WhereAutomationJob) {
automationJobs (where: $where) {
records {
id
friendlyStatus
generatedAssets {
id
filename
size
mimeType
url
checksum
versionId
}
}
}
}
Variables
{
"where": {
"id": {
"in": ["1z_oy8e_Qz8qcFrW5Fw2W"]
}
}
}
Example response
{
"data": {
"automationJobs": {
"records": [
{
"id": "LQ9WIlObxuUOY2qvsB0ui",
"friendlyStatus": "COMPLETE",
"generatedAssets": [
{
"id": "366Fnfb3vNAhygM7SX-Fw",
"filename": "LQ9WIlObxuUOY2qvsB0ui.main_1.api.proof.mov",
"size": 6971172,
"mimeType": "video/quicktime",
"url": "https://a-bucket.s3.eu-west-1.amazonaws.com/automation/api/processed/LQ9WIlObxuUOY2qvsB0ui/AQ9WIlObxuUOY9qvsB0xi.2.api.proof.mov",
"checksum": "6dc5ad9c8dcbf94891cb8ca9c87dba51",
"versionId": "ZtiWWnBm4gTJ0Zmck2tKsmZ_oEz.nI_o"
},
{
"id": "ZKki22Rynm9ethX5zbad-",
"filename": "LQ9WIlObxuUOY2qvsB0ui.main_2.api.proof.mov",
"size": 38836100,
"mimeType": "video/quicktime",
"url": "https://a-bucket.s3.eu-west-1.amazonaws.com/automation/api/processed/LQ9WIlObxuUOY2qvsB0ui/AQ9WIlObxuUOY9qvsB0xi.4.api.proof.mov",
"checksum": "3607f29e48dfe5d9d379beb24269e87f",
"versionId": "LlGxMUYUmjjw8szaLNZKNE.KlKjABd.B"
},
]
}
]
}
}
}