Phua KY profile picture

Phua KY

Log to Telegram from IOS Shortcuts

Send a Message to a Telegram Channel via iOS Shortcut

Follow these steps to create an iOS Shortcut that sends a message to your Telegram channel.

Prerequisites

  • You need to have a Telegram bot and your channel’s chat ID.
  • Your bot must be added as an administrator to the channel with posting permissions.

Instructions

Step 1: Create the Shortcut

  1. Open the Shortcuts app on your iPhone.
  2. Tap the ”+” button to create a new shortcut.

Step 2: Add Input Action

  1. Tap “Add Action”.
  2. Search for and select “Ask for Input”.
  3. Set the prompt to “What is your progress for today?”

Step 3: URL Encode the Input

  1. Tap ”+” to add another action.
  2. Search for “URL Encode”.
  3. Select “Provided Input” as the text to encode.

Step 4: Set Up the GET Request

  1. Add a “Get Contents of URL” action.
  2. Tap on “URL” and construct the Telegram API call as follows:

https://api.telegram.org/botYourBotToken/sendMessage?chat_id=YourChannelChatID&text=EncodedMessage

  • Replace YourBotToken with your actual bot token.
  • Replace YourChannelChatID with the chat ID of your Telegram channel.
  • Use the variable created by the “URL Encode” action where EncodedMessage is.
  1. Ensure that “Method” is set to “GET”.

Step 5: Test the Shortcut

  1. Run the shortcut to make sure it prompts for input and sends the message.
  2. Check your Telegram channel to see if the message is posted.

Additional Information

  • The message text you input will be URL-encoded to ensure that spaces and special characters are correctly interpreted in the URL.
  • If the message does not appear, double-check the bot token, chat ID, and your network connection.

Phua KY profile picture
Multiple business owner wannabe. Big on finding out my fullest potential through mental toughness.
contact