Block reference / Online services

Telegram

Send a message, a picture or both to a Telegram chat, group or channel with your own bot.

In both appsWarpX BrowserWarpX Phone

Use Telegram to hear from a workflow while it runs on many profiles: a run finished, an account was banned, a page looked wrong. The block sends as a bot you create with BotFather, to any chat the bot is in. It can attach a picture, such as the screenshot Take screenshot just took, so you see what the profile saw.

The Telegram block's settings, filled in as in the example below.

Settings

Bot token

The token BotFather gave you, shaped like 123456789:AAF…. Keep it in Databases → Credentials and write {{secrets.telegramBot}}, so it is not saved in the workflow and shows as •••••• in the log.

Example{{secrets.telegramBot}}
Chat ID

Who receives it: a person, a group or a channel the bot is in. A person's ID is a plain number; groups and channels start with -100. It can be a reference, such as {{variables.teamChat}}.

Example-1002143658790
Message

The text to send. References are filled in first. It can be empty when you send a picture; otherwise the block fails with The message is empty.

Example
Sign-in failed on {{variables.profileName}}
Page: {{variables.pageUrl}}
Format

How Telegram reads the text. Plain text sends it as written. HTML understands <b>, <i>, <a href="…"> and <code>. MarkdownV2 understands *bold* and _italic_ but refuses the message if characters such as ., - or ! are not escaped with \.

ExamplePlain text
Picture

Optional. The name of a variable holding a screenshot, which is what Take screenshot saves; a path to an image on this computer, such as C:\Reports\error.png; or an image address starting https://. The message becomes the picture's caption.

ExamplefailShot
Send without a notification sound

Delivers the message silently: it arrives, but the phone does not ring or buzz.

ExampleUnchecked

Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.

What it hands on

Hands nothing on. The log line reads Sent to Telegram, and the block leaves by its single output. When Telegram refuses, the block fails with Telegram's own reason, such as Telegram answered 400: Bad Request: chat not found or Telegram answered 401: Unauthorized for a wrong token.

Example: Send a screenshot to your team's group when a sign-in fails

  1. Start
  2. Open URL
  3. Forms
  4. Click element
  5. Element exists
  6. Take screenshot
  7. Telegram
Where Telegram sits in the example workflow.
  1. In Telegram, open @BotFather, send /newbot, pick a name, and copy the token. Save it in Databases → Credentials as telegramBot.
  2. Add the bot to your team's group and send any message there. Open https://api.telegram.org/bot<token>/getUpdates in a browser and copy the chat.id, such as -1002143658790.
  3. In the workflow, after the sign-in, add Element exists with the selector .account-dashboard.
  4. From its bottom output (not found), add Take screenshot with Assign to variable ticked and the variable named failShot.
  5. Add Telegram. Set Bot token to {{secrets.telegramBot}}, Chat ID to -1002143658790, the message to Sign-in failed on {{variables.profileName}}, and Picture to failShot.
  6. Run it on a profile with a wrong password. The group gets the screenshot with the message under it, and the log reads Sent to Telegram.

On WarpX Phone

  • On WarpX Phone, take the picture with the phone's Screenshot block with Assign to variable ticked, and type that variable's name in Picture. It holds the saved file's path, which is sent as the picture.

Good to know

  • A bot cannot start a conversation. A person must open the bot and press Start first; a group must have the bot as a member; a channel must have it as an administrator.
  • A caption holds 1024 characters. With a picture and a longer message, the picture goes without a caption and the message follows as its own message.
  • Picture accepts {{variables.failShot}} as well as the bare name failShot. A path on this computer needs the WarpX Browser desktop app; the browser extension can send a variable or an image address only.
  • An image address is fetched by Telegram's servers, so it must be public. A page behind a sign-in, or one only the profile's proxy can reach, will not work; take a screenshot instead.
  • The message goes from this computer to api.telegram.org, not through the profile's browser or its proxy.

See also

  • Discord — Post a message, a picture or both to a Discord channel through its webhook.
  • Google Chat — Post a text message to a Google Chat space through its webhook, optionally into a thread.
  • Take screenshot — Captures the visible page, the whole page or one element as an image, and saves it as a file, in the table or in a variable.
  • Element exists — Check whether an element is on the page and continue by one of two outputs.