{
  "name": "Telegram photo to product video bot with Sisif",
  "nodes": [
    {
      "id": "f000d3dc-c991-4ad1-af60-3b6d19ad4da7",
      "name": "Setup instructions",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1000,
        -560
      ],
      "parameters": {
        "content": "## Telegram photo to product video bot\nSend the bot a product photo (optionally with a caption describing the motion) and it replies with a short animated product video.\n\n### Setup\n1. Create a bot with @BotFather and add its token as a **Telegram** credential on every Telegram node.\n2. Create a Sisif API key at https://sisif.ai/users/api-keys/ and add it as a **Bearer Auth** credential named *Sisif API key* on **Create Sisif Video** and **Check Video Status**.\n3. Activate the workflow so Telegram can reach the trigger webhook.\n\n### How it works\nThe photo is downloaded from Telegram and sent to Sisif as base64, so the bot token never leaves n8n inside a file URL. The caption becomes the prompt; without one a default product-showcase prompt is used.",
        "width": 560,
        "height": 480,
        "color": 4
      }
    },
    {
      "id": "f06cdb37-b4e8-403c-89a7-51b47117e7ca",
      "name": "Telegram Photo Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        -900,
        100
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "",
          "name": "Telegram account"
        }
      },
      "webhookId": "a489a5c0-17aa-4c2e-9b6c-6c0d37cc4c5f"
    },
    {
      "id": "86e9b89e-5c01-4a34-95b5-e21956e80f1b",
      "name": "Has Photo?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -680,
        100
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "062c22e8-395b-4d83-bf67-b415991686d2",
              "leftValue": "={{ $json.message.photo }}",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "26ed6b11-32d3-4e03-93e3-1633ea2681e3",
      "name": "Ask For A Photo",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -460,
        300
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Photo Trigger').item.json.message.chat.id }}",
        "text": "Send me a product photo (with an optional caption describing the motion) and I will turn it into a short video.",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "",
          "name": "Telegram account"
        }
      },
      "webhookId": "7cb32f83-f633-4bf0-8634-3a809258e76e"
    },
    {
      "id": "87db7608-89fb-4905-bff2-3d6bd98434da",
      "name": "Download Photo",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -460,
        0
      ],
      "parameters": {
        "resource": "file",
        "fileId": "={{ $json.message.photo[$json.message.photo.length - 1].file_id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "",
          "name": "Telegram account"
        }
      },
      "webhookId": "2beb5fdf-9f38-4208-9ac2-efd6f7d9ff75"
    },
    {
      "id": "5a12ed38-a56f-43cf-a0f6-f77b803e1477",
      "name": "Convert Photo To Base64",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        -240,
        0
      ],
      "parameters": {
        "operation": "binaryToPropery",
        "destinationKey": "image",
        "options": {}
      }
    },
    {
      "id": "f5781f71-3f1f-4e34-956f-b6bd872459f2",
      "name": "Create Sisif Video",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -20,
        0
      ],
      "parameters": {
        "method": "POST",
        "url": "https://sisif.ai/api/videos/generate/",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "prompt",
              "value": "={{ $('Telegram Photo Trigger').item.json.message.caption || 'Smooth slow camera orbit around the product, soft studio lighting, subtle reflections, premium commercial look' }}"
            },
            {
              "name": "image",
              "value": "=data:{{ $('Download Photo').item.binary.data.mimeType || 'image/jpeg' }};base64,{{ $json.image }}"
            }
          ]
        },
        "options": {}
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "",
          "name": "Sisif API key"
        }
      }
    },
    {
      "id": "3fbe13da-0e8c-4462-914a-5e65953601b3",
      "name": "Confirm Generation Started",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        200,
        -160
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Photo Trigger').item.json.message.chat.id }}",
        "text": "Got it, your video is being generated. This usually takes a few minutes.",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "",
          "name": "Telegram account"
        }
      },
      "webhookId": "9aaccd44-c066-4338-9ef0-7aca65ed804d"
    },
    {
      "id": "111e08ec-9c2d-4a03-af59-eb8d6750586f",
      "name": "Wait Before Status Check",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        200,
        0
      ],
      "parameters": {
        "amount": 15
      },
      "webhookId": "cfbe0f82-32b6-4fbd-a974-af1d8081d953"
    },
    {
      "id": "4e3cc9f7-6b76-478e-8fff-08d5aa9b2895",
      "name": "Check Video Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        420,
        0
      ],
      "parameters": {
        "url": "=https://sisif.ai/api/videos/{{ $json.poll_id }}/",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "options": {}
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "",
          "name": "Sisif API key"
        }
      }
    },
    {
      "id": "145f855b-dc4e-47e3-a264-13f8ce86ceb7",
      "name": "Is Video Ready?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        640,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "ab970ebc-da8a-4b75-b501-ff1501111932",
              "leftValue": "={{ $json.status }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "rightValue": "READY"
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "20e4606e-a814-4da5-820a-d7fc9e54e89a",
      "name": "Did Generation Fail?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        860,
        120
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "c9ccfe32-6876-49fd-b796-3be21ec35490",
              "leftValue": "={{ $json.status }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "rightValue": "ERROR"
            },
            {
              "id": "5a89b7fd-4e67-483c-a6ff-21aebcaae996",
              "leftValue": "={{ $json.status }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "rightValue": "REFUNDED"
            }
          ],
          "combinator": "or"
        },
        "options": {}
      }
    },
    {
      "id": "94abe820-24ef-444a-9b4e-92120fe651f7",
      "name": "Send Video",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        860,
        -120
      ],
      "parameters": {
        "operation": "sendVideo",
        "chatId": "={{ $('Telegram Photo Trigger').item.json.message.chat.id }}",
        "file": "={{ $json.video_url }}",
        "additionalFields": {
          "caption": "Here is your product video."
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "",
          "name": "Telegram account"
        }
      },
      "webhookId": "7e926b5c-cee7-4855-99b1-073772e22539"
    },
    {
      "id": "c9316d4c-7ca5-4b7f-aeeb-2337dd462c9f",
      "name": "Report Failure",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1080,
        100
      ],
      "parameters": {
        "chatId": "={{ $('Telegram Photo Trigger').item.json.message.chat.id }}",
        "text": "=Sorry, the video could not be generated ({{ String($json.error_message || ($json.attempt >= 40 ? 'timed out' : $json.status)).replace(/[_*`\\[\\]]/g, ' ') }}). Please try another photo.",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "",
          "name": "Telegram account"
        }
      },
      "webhookId": "3b19561a-bec6-475b-b00c-5cb3ad82e7c3"
    },
    {
      "id": "442405f6-2497-4dfb-b438-f80f79471c0e",
      "name": "Start Poll Counter",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        90,
        180
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6a19b178-5461-4a1c-8355-ccce3810701b",
              "name": "poll_id",
              "value": "={{ $json.id }}",
              "type": "string"
            },
            {
              "id": "b7ed196d-f991-478e-bded-56feb866429c",
              "name": "attempt",
              "value": "0",
              "type": "number"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "f0073ccb-979a-4193-afd9-8c7ea18ab851",
      "name": "Track Poll Attempt",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        530,
        180
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b0e5b762-a49c-41b4-a7fc-7e4b3c502cad",
              "name": "poll_id",
              "value": "={{ $('Wait Before Status Check').item.json.poll_id }}",
              "type": "string"
            },
            {
              "id": "e68968c7-cd95-4c79-aba0-2291f7ab32e4",
              "name": "attempt",
              "value": "={{ $('Wait Before Status Check').item.json.attempt + 1 }}",
              "type": "number"
            }
          ]
        },
        "options": {},
        "includeOtherFields": true
      }
    },
    {
      "id": "8aab2a12-e87b-4493-b334-7b93021df9d5",
      "name": "Under Max Attempts?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        750,
        400
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "e93bee32-480e-43ad-84dd-07465f58a7ae",
              "leftValue": "={{ $json.attempt }}",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "rightValue": 40
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    }
  ],
  "connections": {
    "Telegram Photo Trigger": {
      "main": [
        [
          {
            "node": "Has Photo?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Photo": {
      "main": [
        [
          {
            "node": "Convert Photo To Base64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Photo To Base64": {
      "main": [
        [
          {
            "node": "Create Sisif Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Sisif Video": {
      "main": [
        [
          {
            "node": "Confirm Generation Started",
            "type": "main",
            "index": 0
          },
          {
            "node": "Start Poll Counter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Before Status Check": {
      "main": [
        [
          {
            "node": "Check Video Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Video Status": {
      "main": [
        [
          {
            "node": "Track Poll Attempt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Photo?": {
      "main": [
        [
          {
            "node": "Download Photo",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ask For A Photo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Video Ready?": {
      "main": [
        [
          {
            "node": "Send Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Did Generation Fail?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Did Generation Fail?": {
      "main": [
        [
          {
            "node": "Report Failure",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Under Max Attempts?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Poll Counter": {
      "main": [
        [
          {
            "node": "Wait Before Status Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Track Poll Attempt": {
      "main": [
        [
          {
            "node": "Is Video Ready?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Under Max Attempts?": {
      "main": [
        [
          {
            "node": "Wait Before Status Check",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Report Failure",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}