{ "kind": "open-flow-workflow", "version": 1, "name": "Daily Cocktail Photo in Telegram", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_c3ade81dafa515a0": { "name": "Every day at 20:00 UTC", "kind": "cron", "cronTimes": [ { "type": "cron", "expression": "0 20 * * *", "timezone": "UTC" } ] }, "n_2640f644059604c7": { "inputs": { "url": { "kind": "value", "value": "https://www.thecocktaildb.com/api/json/v1/1/random.php" } }, "name": "Get a random cocktail", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Get a random cocktail", "executor": { "method": "GET", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "none", "authentication": { "type": "none" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_17bf58ab1452b988": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2640f644059604c7", "output": "body" } ] } }, "name": "Select photo and instructions", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "string", "minLength": 1, "description": "The photo URL or existing Telegram file_id to send." }, "nullable": false, "handle": "photo" }, { "jsonSchema": { "type": "string", "maxLength": 1024, "description": "The caption for the photo." }, "nullable": true, "handle": "caption" } ], "name": "Select photo and instructions", "moduleId": "n_4da62540e8bfde5b", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_d79553048aeb1c93": { "inputs": { "chatId": { "kind": "value", "value": "@YOUR_TELEGRAM_CHANNEL" }, "photo": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_17bf58ab1452b988", "output": "photo" } ] }, "caption": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_17bf58ab1452b988", "output": "caption" } ] } }, "name": "Send cocktail photo to Telegram", "kind": "task", "task": { "inputs": [ { "description": "The target Telegram chat ID or channel username.", "jsonSchema": { "anyOf": [ { "type": "integer", "description": "A union variant." }, { "type": "string", "pattern": "^-?\\d+$", "description": "A numeric Telegram chat identifier encoded as a string." }, { "type": "string", "pattern": "^@[A-Za-z0-9_]+$", "description": "A Telegram @username that identifies a public chat or channel." } ], "description": "The target Telegram chat ID or channel username." }, "nullable": false, "handle": "chatId" }, { "description": "The photo URL or existing Telegram file_id to send.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The photo URL or existing Telegram file_id to send." }, "nullable": false, "handle": "photo" }, { "description": "The caption for the photo.", "jsonSchema": { "type": "string", "maxLength": 1024, "description": "The caption for the photo." }, "nullable": true, "handle": "caption", "value": null }, { "description": "The parse mode used for message entities.", "jsonSchema": { "type": "string", "enum": [ "Markdown", "MarkdownV2", "HTML" ], "description": "The parse mode used for message entities." }, "nullable": true, "handle": "parseMode", "value": null }, { "description": "Whether to send the photo silently.", "jsonSchema": { "type": "boolean", "description": "Whether to send the photo silently." }, "nullable": true, "handle": "disableNotification", "value": null }, { "description": "Whether to protect the photo from forwarding and saving.", "jsonSchema": { "type": "boolean", "description": "Whether to protect the photo from forwarding and saving." }, "nullable": true, "handle": "protectContent", "value": null }, { "description": "The forum topic ID for the target message thread.", "jsonSchema": { "type": "integer", "exclusiveMinimum": 0, "description": "The forum topic ID for the target message thread." }, "nullable": true, "handle": "messageThreadId", "value": null }, { "description": "The message ID to reply to.", "jsonSchema": { "type": "integer", "exclusiveMinimum": 0, "description": "The message ID to reply to." }, "nullable": true, "handle": "replyToMessageId", "value": null } ], "outputs": [ { "description": "The unique message identifier inside the chat.", "jsonSchema": { "type": "integer", "description": "The unique message identifier inside the chat." }, "nullable": false, "handle": "messageId" }, { "description": "The Unix timestamp when the message was sent.", "jsonSchema": { "type": "integer", "description": "The Unix timestamp when the message was sent." }, "nullable": false, "handle": "date" }, { "description": "The chat the message belongs to.", "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The unique identifier of the chat." }, "type": { "type": "string", "description": "The chat type, such as private, group, supergroup, or channel." }, "title": { "type": "string", "description": "The chat title for groups, supergroups, and channels." }, "username": { "type": "string", "description": "The public username of the chat, when available." }, "firstName": { "type": "string", "description": "The first name for a private chat counterpart." }, "lastName": { "type": "string", "description": "The last name for a private chat counterpart." }, "isForum": { "type": "boolean", "description": "Whether the supergroup chat is a forum." } }, "required": [ "id", "type" ], "additionalProperties": false, "description": "The chat the message belongs to." }, "nullable": false, "handle": "chat" }, { "description": "The sender of the message.", "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The unique identifier of the user or bot." }, "isBot": { "type": "boolean", "description": "Whether this account is a bot." }, "firstName": { "type": "string", "description": "The first name of the user or bot." }, "username": { "type": "string", "description": "The username of the user or bot." }, "languageCode": { "type": "string", "description": "The IETF language tag of the user." }, "canJoinGroups": { "type": "boolean", "description": "Whether the bot can be invited to groups." }, "canReadAllGroupMessages": { "type": "boolean", "description": "Whether privacy mode is disabled for the bot." }, "supportsInlineQueries": { "type": "boolean", "description": "Whether the bot supports inline queries." }, "canConnectToBusiness": { "type": "boolean", "description": "Whether the bot can be connected to a Telegram Business account." }, "hasMainWebApp": { "type": "boolean", "description": "Whether the bot has a main Web App configured." } }, "required": [ "id", "isBot", "firstName" ], "additionalProperties": false, "description": "The sender of the message." }, "nullable": true, "handle": "from" }, { "description": "The chat on behalf of which the message was sent.", "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The unique identifier of the chat." }, "type": { "type": "string", "description": "The chat type, such as private, group, supergroup, or channel." }, "title": { "type": "string", "description": "The chat title for groups, supergroups, and channels." }, "username": { "type": "string", "description": "The public username of the chat, when available." }, "firstName": { "type": "string", "description": "The first name for a private chat counterpart." }, "lastName": { "type": "string", "description": "The last name for a private chat counterpart." }, "isForum": { "type": "boolean", "description": "Whether the supergroup chat is a forum." } }, "required": [ "id", "type" ], "additionalProperties": false, "description": "The chat on behalf of which the message was sent." }, "nullable": true, "handle": "senderChat" }, { "description": "The UTF-8 text of the message, for text messages.", "jsonSchema": { "type": "string", "description": "The UTF-8 text of the message, for text messages." }, "nullable": true, "handle": "text" }, { "description": "The caption for media messages.", "jsonSchema": { "type": "string", "description": "The caption for media messages." }, "nullable": true, "handle": "caption" }, { "description": "The available sizes for an attached photo.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "fileId": { "type": "string", "description": "The file identifier used to download or reuse the photo." }, "fileUniqueId": { "type": "string", "description": "The stable unique identifier of the photo." }, "width": { "type": "integer", "description": "The photo width in pixels." }, "height": { "type": "integer", "description": "The photo height in pixels." }, "fileSize": { "type": "integer", "description": "The photo file size in bytes." } }, "required": [ "fileId", "fileUniqueId", "width", "height" ], "additionalProperties": false, "description": "A Telegram photo size record." }, "description": "The available sizes for an attached photo." }, "nullable": true, "handle": "photo" }, { "description": "The attached document, when present.", "jsonSchema": { "type": "object", "properties": { "fileId": { "type": "string", "description": "The file identifier used to download or reuse the document." }, "fileUniqueId": { "type": "string", "description": "The stable unique identifier of the document." }, "fileName": { "type": "string", "description": "The original filename of the document." }, "mimeType": { "type": "string", "description": "The MIME type of the document." }, "fileSize": { "type": "integer", "description": "The document size in bytes." } }, "required": [ "fileId", "fileUniqueId" ], "additionalProperties": false, "description": "The attached document, when present." }, "nullable": true, "handle": "document" }, { "description": "The attached location, when present.", "jsonSchema": { "type": "object", "properties": { "latitude": { "type": "number", "description": "The latitude of the location." }, "longitude": { "type": "number", "description": "The longitude of the location." }, "horizontalAccuracy": { "type": "number", "description": "The radius of uncertainty for the location, in meters." }, "livePeriod": { "type": "integer", "description": "The live location update period in seconds." }, "heading": { "type": "integer", "description": "The direction in which the user is moving, in degrees." }, "proximityAlertRadius": { "type": "integer", "description": "The distance in meters for proximity alerts." } }, "required": [ "latitude", "longitude" ], "additionalProperties": false, "description": "The attached location, when present." }, "nullable": true, "handle": "location" }, { "description": "The attached poll, when present.", "jsonSchema": { "type": "object", "properties": { "id": { "type": "string", "description": "The unique identifier of the poll." }, "question": { "type": "string", "description": "The poll question text." }, "options": { "type": "array", "items": { "type": "object", "properties": { "text": { "type": "string", "description": "The text of the poll option." }, "voterCount": { "type": "integer", "description": "The number of votes received by this option." } }, "required": [ "text", "voterCount" ], "additionalProperties": false, "description": "A Telegram poll option." }, "description": "The options available in the poll." }, "totalVoterCount": { "type": "integer", "description": "The total number of users that voted." }, "isClosed": { "type": "boolean", "description": "Whether the poll is closed." }, "isAnonymous": { "type": "boolean", "description": "Whether the poll is anonymous." }, "type": { "type": "string", "enum": [ "regular", "quiz" ], "description": "The type of the poll." }, "allowsMultipleAnswers": { "type": "boolean", "description": "Whether multiple answers are allowed." }, "closeDate": { "type": "integer", "description": "The Unix timestamp when the poll closes." }, "openPeriod": { "type": "integer", "description": "The amount of time in seconds the poll stays open." }, "explanation": { "type": "string", "description": "The explanation text shown for quiz polls." }, "correctOptionId": { "type": "integer", "description": "The index of the correct option for quiz polls." } }, "required": [ "id", "question", "options", "totalVoterCount", "isClosed", "isAnonymous", "type", "allowsMultipleAnswers" ], "additionalProperties": false, "description": "The attached poll, when present." }, "nullable": true, "handle": "poll" }, { "description": "The message entities parsed from the text.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": {}, "additionalProperties": true, "description": "Schema for anyObject." }, "description": "The message entities parsed from the text." }, "nullable": true, "handle": "entities" }, { "description": "The message entities parsed from the caption.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": {}, "additionalProperties": true, "description": "Schema for anyObject." }, "description": "The message entities parsed from the caption." }, "nullable": true, "handle": "captionEntities" }, { "description": "The Unix timestamp of the original forwarded message.", "jsonSchema": { "type": "integer", "description": "The Unix timestamp of the original forwarded message." }, "nullable": true, "handle": "forwardDate" }, { "description": "The original sender of a forwarded message.", "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The unique identifier of the user or bot." }, "isBot": { "type": "boolean", "description": "Whether this account is a bot." }, "firstName": { "type": "string", "description": "The first name of the user or bot." }, "username": { "type": "string", "description": "The username of the user or bot." }, "languageCode": { "type": "string", "description": "The IETF language tag of the user." }, "canJoinGroups": { "type": "boolean", "description": "Whether the bot can be invited to groups." }, "canReadAllGroupMessages": { "type": "boolean", "description": "Whether privacy mode is disabled for the bot." }, "supportsInlineQueries": { "type": "boolean", "description": "Whether the bot supports inline queries." }, "canConnectToBusiness": { "type": "boolean", "description": "Whether the bot can be connected to a Telegram Business account." }, "hasMainWebApp": { "type": "boolean", "description": "Whether the bot has a main Web App configured." } }, "required": [ "id", "isBot", "firstName" ], "additionalProperties": false, "description": "The original sender of a forwarded message." }, "nullable": true, "handle": "forwardFrom" }, { "description": "The original chat of a forwarded message sent on behalf of a chat.", "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The unique identifier of the chat." }, "type": { "type": "string", "description": "The chat type, such as private, group, supergroup, or channel." }, "title": { "type": "string", "description": "The chat title for groups, supergroups, and channels." }, "username": { "type": "string", "description": "The public username of the chat, when available." }, "firstName": { "type": "string", "description": "The first name for a private chat counterpart." }, "lastName": { "type": "string", "description": "The last name for a private chat counterpart." }, "isForum": { "type": "boolean", "description": "Whether the supergroup chat is a forum." } }, "required": [ "id", "type" ], "additionalProperties": false, "description": "The original chat of a forwarded message sent on behalf of a chat." }, "nullable": true, "handle": "forwardFromChat" }, { "description": "The original message ID inside the source channel.", "jsonSchema": { "type": "integer", "description": "The original message ID inside the source channel." }, "nullable": true, "handle": "forwardFromMessageId" }, { "description": "The original author signature for a forwarded post.", "jsonSchema": { "type": "string", "description": "The original author signature for a forwarded post." }, "nullable": true, "handle": "forwardSignature" }, { "description": "The display name of a forwarded sender who disallows linking.", "jsonSchema": { "type": "string", "description": "The display name of a forwarded sender who disallows linking." }, "nullable": true, "handle": "forwardSenderName" }, { "description": "The link preview options attached to the message.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The link preview options attached to the message." }, "nullable": true, "handle": "linkPreviewOptions" } ], "name": "Send cocktail photo to Telegram", "executor": { "kind": "connector", "action": "telegram.send_photo" } } }, "n_1db0e0a2db19d7c0": { "name": "Sent photo confirmation", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "integer", "description": "The unique message identifier inside the chat." }, "nullable": false, "handle": "messageId" }, { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "description": "The unique identifier of the chat." }, "type": { "type": "string", "description": "The chat type, such as private, group, supergroup, or channel." }, "title": { "type": "string", "description": "The chat title for groups, supergroups, and channels." }, "username": { "type": "string", "description": "The public username of the chat, when available." }, "firstName": { "type": "string", "description": "The first name for a private chat counterpart." }, "lastName": { "type": "string", "description": "The last name for a private chat counterpart." }, "isForum": { "type": "boolean", "description": "Whether the supergroup chat is a forum." } }, "required": [ "id", "type" ], "additionalProperties": false, "description": "The chat the message belongs to." }, "nullable": false, "handle": "chat" }, { "jsonSchema": { "type": "string", "description": "The caption for media messages." }, "nullable": true, "handle": "caption" } ], "outputMappings": { "messageId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d79553048aeb1c93", "output": "messageId" } ] }, "chat": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d79553048aeb1c93", "output": "chat" } ] }, "caption": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d79553048aeb1c93", "output": "caption" } ] } } } }, "edges": [ { "source": "n_c3ade81dafa515a0", "target": "n_2640f644059604c7" }, { "source": "n_2640f644059604c7", "target": "n_17bf58ab1452b988" }, { "source": "n_17bf58ab1452b988", "target": "n_d79553048aeb1c93" }, { "source": "n_d79553048aeb1c93", "target": "n_1db0e0a2db19d7c0" } ] } }, "modules": { "n_4da62540e8bfde5b": { "name": "Select photo and instructions", "imports": [], "source": "export default function cocktailPhoto({ body }) {\n const drink = Array.isArray(body?.drinks) && body.drinks[0];\n const photo = drink?.strDrinkThumb;\n const parts = typeof photo === 'string' && /^https?:\\/\\/(\\[[0-9a-f:.]+\\]|[^\\s/\\\\?#@:%\\[\\]<>\"`]+)(?::(\\d{1,5}))?(?:[/?#][^\\s\\\\]*)?$/i.exec(photo);\n if (!parts || /[\\u0000-\\u0020\\u007f]/.test(photo) || parts[2] && Number(parts[2]) > 65535) throw new Error('TheCocktailDB returned no usable HTTP(S) photo URL');\n const caption = drink.strInstructions ?? null;\n if (caption !== null && typeof caption !== 'string') throw new Error('TheCocktailDB instructions must be text or absent');\n if (caption !== null && caption.length > 1024) throw new Error('The cocktail instructions exceed the Telegram Action caption limit');\n return { photo, caption };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }