zebflow 0.11.14

Reactive web automation platform — pipelines, templates, and real-time collaboration in a single binary.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
{
  "apiVersion": "zebflow.com/v1",
  "kind": "NodeBundle",
  "metadata": {
    "name": "telegram",
    "version": "1.0.0"
  },
  "spec": {
    "package": "telegram",
    "version": "1.0.0",
    "title": "Telegram",
    "description": "Telegram Bot — send and edit messages, receive updates via webhook.",
    "icon": "icon.svg",
    "credentials": [
      {
        "kind": "telegram_bot",
        "title": "Telegram Bot",
        "description": "Bot token from @BotFather on Telegram.",
        "fields": [
          {
            "key": "token",
            "label": "Bot Token",
            "type": "password",
            "required": true,
            "placeholder": "<bot id>:<token from @BotFather>",
            "help": "Get this from @BotFather on Telegram."
          },
          {
            "key": "webhook_secret",
            "label": "Webhook Secret",
            "type": "password",
            "required": false,
            "generate": "random_hex_32",
            "help": "The secret Telegram sends with every update; an update without it is refused. Generated when the trigger is activated if empty."
          }
        ],
        "placeholders": {
          "BOT_TOKEN": "token",
          "WEBHOOK_SECRET": "webhook_secret"
        },
        "config_key": "credential_id"
      }
    ],
    "hosts": [
      "api.telegram.org"
    ],
    "functions": {
      "send-message": "functions/send-message.zf.json",
      "edit-message": "functions/edit-message.zf.json",
      "register-webhook": "functions/register-webhook.zf.json",
      "delete-webhook": "functions/delete-webhook.zf.json",
      "transform-update": "functions/transform-update.zf.json"
    },
    "modules": {},
    "nodes": [
      {
        "kind": "trigger.telegram",
        "title": "Telegram Trigger",
        "description": "Starts a run for each update the bot receives. Answers `telegram`: the update, flattened — `{ update_id, type, chat_id, message_id, from_id, text, … }`, `type` being message, edited_message, callback_query (with `data`), inline_query (with `query`) or unknown (with `raw`). Activating the pipeline registers the webhook with Telegram, deactivating it removes it.",
        "icon": "icons/trigger.svg",
        "ui_category": "communication.telegram",
        "ui_category_label": "Telegram",
        "uses_credentials": [
          "telegram_bot"
        ],
        "run": {
          "function": "transform-update"
        },
        "trigger": {
          "type": "webhook",
          "path_template": "/tg/{{ credential_id }}",
          "secret_header": {
            "header": "X-Telegram-Bot-Api-Secret-Token",
            "placeholder": "WEBHOOK_SECRET"
          }
        },
        "lifecycle": {
          "on_activate": {
            "function": "register-webhook"
          },
          "on_deactivate": {
            "function": "delete-webhook"
          }
        },
        "definition": {
          "input_pins": [],
          "output_pins": [
            "out"
          ],
          "config_schema": {
            "type": "object",
            "properties": {
              "credential_id": {
                "type": "string"
              },
              "event": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "output_schema": {
            "type": "object",
            "properties": {
              "telegram": {
                "type": "object",
                "description": "The update, flattened: update_id, type, chat_id, message_id, from_id, text, …"
              }
            }
          },
          "dsl_flags": [
            {
              "flag": "--credential",
              "config_key": "credential_id",
              "kind": "scalar",
              "required": true,
              "value": "text",
              "description": "The telegram_bot credential: the bot whose updates start the pipeline."
            },
            {
              "flag": "--event",
              "config_key": "event",
              "kind": "repeated_list",
              "required": false,
              "value": "text",
              "choices": [
                "message",
                "edited_message",
                "channel_post",
                "edited_channel_post",
                "business_connection",
                "business_message",
                "edited_business_message",
                "deleted_business_messages",
                "message_reaction",
                "message_reaction_count",
                "inline_query",
                "chosen_inline_result",
                "callback_query",
                "shipping_query",
                "pre_checkout_query",
                "purchased_paid_media",
                "poll",
                "poll_answer",
                "my_chat_member",
                "chat_member",
                "chat_join_request",
                "chat_boost",
                "removed_chat_boost"
              ],
              "description": "An update type to receive — repeat for several. Omitted: Telegram's default, every type but chat_member, message_reaction and message_reaction_count."
            }
          ],
          "fields": [
            {
              "name": "credential_id",
              "label": "Bot Credential",
              "type": "select",
              "data_source": "credentials:telegram_bot",
              "help": "The telegram_bot credential whose updates start this pipeline."
            },
            {
              "name": "event",
              "label": "Events",
              "type": "multi_checkbox",
              "options": [
                { "value": "message", "label": "message" },
                { "value": "edited_message", "label": "edited_message" },
                { "value": "channel_post", "label": "channel_post" },
                { "value": "edited_channel_post", "label": "edited_channel_post" },
                { "value": "business_connection", "label": "business_connection" },
                { "value": "business_message", "label": "business_message" },
                { "value": "edited_business_message", "label": "edited_business_message" },
                { "value": "deleted_business_messages", "label": "deleted_business_messages" },
                { "value": "message_reaction", "label": "message_reaction" },
                { "value": "message_reaction_count", "label": "message_reaction_count" },
                { "value": "inline_query", "label": "inline_query" },
                { "value": "chosen_inline_result", "label": "chosen_inline_result" },
                { "value": "callback_query", "label": "callback_query" },
                { "value": "shipping_query", "label": "shipping_query" },
                { "value": "pre_checkout_query", "label": "pre_checkout_query" },
                { "value": "purchased_paid_media", "label": "purchased_paid_media" },
                { "value": "poll", "label": "poll" },
                { "value": "poll_answer", "label": "poll_answer" },
                { "value": "my_chat_member", "label": "my_chat_member" },
                { "value": "chat_member", "label": "chat_member" },
                { "value": "chat_join_request", "label": "chat_join_request" },
                { "value": "chat_boost", "label": "chat_boost" },
                { "value": "removed_chat_boost", "label": "removed_chat_boost" }
              ],
              "help": "The update types to receive. None ticked: Telegram's default, every type but chat_member, message_reaction and message_reaction_count."
            }
          ],
          "layout": [
            "credential_id",
            "event"
          ]
        }
      },
      {
        "kind": "telegram.message.send",
        "title": "Telegram Send Message",
        "description": "Sends a message to a Telegram chat through the Bot API. It sends text, or a photo (`--image`) or a document (`--file`) with `--text` as its caption. `--image` and `--file` take a URL Telegram can fetch or a Telegram file_id. Answers `message: { id, recipient, sent_at, telegram }` — `recipient` is the chat id, `telegram` the Message Telegram returned — and keeps the payload; a refusal from Telegram delivers `error`.",
        "icon": "icons/message-send.svg",
        "ui_category": "communication.telegram",
        "ui_category_label": "Telegram",
        "uses_credentials": [
          "telegram_bot"
        ],
        "run": {
          "function": "send-message"
        },
        "definition": {
          "input_pins": [
            "in"
          ],
          "output_pins": [
            "out",
            "error"
          ],
          "config_schema": {
            "type": "object",
            "properties": {
              "credential_id": { "type": "string" },
              "recipient": { "type": ["string", "number"] },
              "text": { "type": "string" },
              "image": { "type": "string" },
              "file": { "type": "string" },
              "format": { "type": "string", "enum": ["text", "markdown", "html"] },
              "keyboard": { "type": ["object", "string"] },
              "in_reply_to": { "type": ["number", "string"] },
              "silent": { "type": "boolean" }
            }
          },
          "output_schema": {
            "type": "object",
            "properties": {
              "message": {
                "type": "object",
                "properties": {
                  "id": { "type": "integer" },
                  "recipient": { "description": "The chat id." },
                  "sent_at": { "type": "string", "description": "ISO 8601." },
                  "telegram": { "type": "object", "description": "The Message object Telegram returned." }
                }
              }
            }
          },
          "dsl_flags": [
            {
              "flag": "--credential",
              "config_key": "credential_id",
              "kind": "scalar",
              "required": true,
              "value": "text",
              "description": "The telegram_bot credential: the bot that sends."
            },
            {
              "flag": "--recipient",
              "config_key": "recipient",
              "kind": "scalar",
              "required": true,
              "value": "text",
              "description": "The chat to send to: its id, or @username of a public channel."
            },
            {
              "flag": "--text",
              "config_key": "text",
              "kind": "scalar",
              "required": true,
              "value": "text",
              "description": "The message text; with --image or --file, its caption."
            },
            {
              "flag": "--image",
              "config_key": "image",
              "kind": "scalar",
              "required": false,
              "value": "text",
              "description": "A photo to send: a URL Telegram can fetch, or a Telegram file_id. Not with --file."
            },
            {
              "flag": "--file",
              "config_key": "file",
              "kind": "scalar",
              "required": false,
              "value": "text",
              "description": "A document to send: a URL Telegram can fetch, or a Telegram file_id. Not with --image."
            },
            {
              "flag": "--format",
              "config_key": "format",
              "kind": "scalar",
              "required": false,
              "value": "text",
              "choices": ["text", "markdown", "html"],
              "description": "How --text is read: text (default), markdown (Telegram MarkdownV2) or html."
            },
            {
              "flag": "--keyboard",
              "config_key": "keyboard",
              "kind": "key_value_pairs",
              "required": false,
              "value": "text",
              "description": "An inline button, LABEL=DATA, one per row; DATA comes back as a callback_query's data. Repeat for several, or one {{ object }}."
            },
            {
              "flag": "--in-reply-to",
              "config_key": "in_reply_to",
              "kind": "scalar",
              "required": false,
              "value": "number",
              "description": "The id of a message in the same chat this one replies to."
            },
            {
              "flag": "--silent",
              "config_key": "silent",
              "kind": "bool",
              "required": false,
              "description": "Deliver without a notification sound."
            }
          ],
          "fields": [
            {
              "name": "credential_id",
              "label": "Bot Credential",
              "type": "select",
              "data_source": "credentials:telegram_bot",
              "help": "The telegram_bot credential that sends."
            },
            {
              "name": "recipient",
              "label": "Recipient",
              "type": "text",
              "help": "The chat id, or @username of a public channel. Literal or {{ expr }}."
            },
            {
              "name": "text",
              "label": "Text",
              "type": "textarea",
              "rows": 4,
              "help": "The message, or the caption of the image or file. Literal or {{ expr }}."
            },
            {
              "name": "image",
              "label": "Image",
              "type": "text",
              "help": "A photo URL or Telegram file_id. Leave empty for a text message."
            },
            {
              "name": "file",
              "label": "File",
              "type": "text",
              "help": "A document URL or Telegram file_id. Not together with an image."
            },
            {
              "name": "format",
              "label": "Format",
              "type": "select",
              "options": [
                { "value": "text", "label": "text" },
                { "value": "markdown", "label": "markdown" },
                { "value": "html", "label": "html" }
              ],
              "help": "How the text is read: text (default), markdown (MarkdownV2) or html."
            },
            {
              "name": "keyboard",
              "label": "Keyboard",
              "type": "key_value_pairs",
              "help": "Inline buttons, one per row: a label and the data a press sends back."
            },
            {
              "name": "in_reply_to",
              "label": "In Reply To",
              "type": "text",
              "help": "The id of a message in the same chat this one replies to."
            },
            {
              "name": "silent",
              "label": "Silent",
              "type": "checkbox",
              "help": "Deliver without a notification sound."
            }
          ],
          "layout": [
            "credential_id",
            "recipient",
            "text",
            "image",
            "file",
            "format",
            "keyboard",
            "in_reply_to",
            "silent"
          ]
        }
      },
      {
        "kind": "telegram.message.edit",
        "title": "Telegram Edit Message",
        "description": "Replaces the text (and the inline keyboard) of a message the bot sent. Answers `message: { id, recipient, sent_at, edited_at, telegram }` and keeps the payload; a refusal from Telegram delivers `error`.",
        "icon": "icons/message-edit.svg",
        "ui_category": "communication.telegram",
        "ui_category_label": "Telegram",
        "uses_credentials": [
          "telegram_bot"
        ],
        "run": {
          "function": "edit-message"
        },
        "definition": {
          "input_pins": [
            "in"
          ],
          "output_pins": [
            "out",
            "error"
          ],
          "config_schema": {
            "type": "object",
            "properties": {
              "credential_id": { "type": "string" },
              "recipient": { "type": ["string", "number"] },
              "id": { "type": ["number", "string"] },
              "text": { "type": "string" },
              "format": { "type": "string", "enum": ["text", "markdown", "html"] },
              "keyboard": { "type": ["object", "string"] }
            }
          },
          "output_schema": {
            "type": "object",
            "properties": {
              "message": {
                "type": "object",
                "properties": {
                  "id": { "type": "integer" },
                  "recipient": { "description": "The chat id." },
                  "sent_at": { "type": "string", "description": "ISO 8601." },
                  "edited_at": { "type": "string", "description": "ISO 8601." },
                  "telegram": { "type": "object", "description": "The Message object Telegram returned." }
                }
              }
            }
          },
          "dsl_flags": [
            {
              "flag": "--credential",
              "config_key": "credential_id",
              "kind": "scalar",
              "required": true,
              "value": "text",
              "description": "The telegram_bot credential: the bot that sent the message."
            },
            {
              "flag": "--recipient",
              "config_key": "recipient",
              "kind": "scalar",
              "required": true,
              "value": "text",
              "description": "The chat the message is in: its id, or @username of a public channel."
            },
            {
              "flag": "--id",
              "config_key": "id",
              "kind": "scalar",
              "required": true,
              "value": "number",
              "description": "The message to edit, e.g. {{ input.message.id }}."
            },
            {
              "flag": "--text",
              "config_key": "text",
              "kind": "scalar",
              "required": true,
              "value": "text",
              "description": "The new text."
            },
            {
              "flag": "--format",
              "config_key": "format",
              "kind": "scalar",
              "required": false,
              "value": "text",
              "choices": ["text", "markdown", "html"],
              "description": "How --text is read: text (default), markdown (Telegram MarkdownV2) or html."
            },
            {
              "flag": "--keyboard",
              "config_key": "keyboard",
              "kind": "key_value_pairs",
              "required": false,
              "value": "text",
              "description": "The new inline buttons, LABEL=DATA, one per row. Repeat for several, or one {{ object }}."
            }
          ],
          "fields": [
            {
              "name": "credential_id",
              "label": "Bot Credential",
              "type": "select",
              "data_source": "credentials:telegram_bot",
              "help": "The telegram_bot credential that sent the message."
            },
            {
              "name": "recipient",
              "label": "Recipient",
              "type": "text",
              "help": "The chat id, or @username of a public channel. Literal or {{ expr }}."
            },
            {
              "name": "id",
              "label": "Message Id",
              "type": "text",
              "help": "The message to edit, e.g. {{ input.message.id }}."
            },
            {
              "name": "text",
              "label": "Text",
              "type": "textarea",
              "rows": 4,
              "help": "The new text. Literal or {{ expr }}."
            },
            {
              "name": "format",
              "label": "Format",
              "type": "select",
              "options": [
                { "value": "text", "label": "text" },
                { "value": "markdown", "label": "markdown" },
                { "value": "html", "label": "html" }
              ],
              "help": "How the text is read: text (default), markdown (MarkdownV2) or html."
            },
            {
              "name": "keyboard",
              "label": "Keyboard",
              "type": "key_value_pairs",
              "help": "The new inline buttons, one per row: a label and the data a press sends back."
            }
          ],
          "layout": [
            "credential_id",
            "recipient",
            "id",
            "text",
            "format",
            "keyboard"
          ]
        }
      }
    ]
  }
}