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
- Open the Shortcuts app on your iPhone.
- Tap the ”+” button to create a new shortcut.
Step 2: Add Input Action
- Tap “Add Action”.
- Search for and select “Ask for Input”.
- Set the prompt to “What is your progress for today?”
Step 3: URL Encode the Input
- Tap ”+” to add another action.
- Search for “URL Encode”.
- Select “Provided Input” as the text to encode.
Step 4: Set Up the GET Request
- Add a “Get Contents of URL” action.
- 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.
- Ensure that “Method” is set to “GET”.
Step 5: Test the Shortcut
- Run the shortcut to make sure it prompts for input and sends the message.
- 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.