This demo shows how to use the Telegram Adapter.
Telegram Adapter package: https://openexchange.intersystems.com/package/telegram-adapter
With this app, the bot responds to any message in chats.
- Create a Telegram bot and obtain a token (see instructions below)
- Make sure you have IPM installed in your InterSystems IRIS. Open Terminal. Select IRIS Namespace with Interoperability Enabled. Call:
USER>zpm "install telegram-adapter-demo -D TgToken=your_telegram_token"
- Open the production
Telegram.Demo.EchoProduction
- Check the required parameters to connect to telegram API in the
Telegram.BusinessOperation
business operation and in theTelegram.LongPollingService
business service (Connection Settings block)- Server (usually
api.telegram.org
) - Token
- SSL Configuration
- Server (usually
- Check the parameters in the Telegram.LongPollingService service (Telegram Settings block). Make sure the FilesPath parameter is set to an existing path on your server. The FilesSave, FilesMimeTypes and FilesPath parameters are used to work with incoming files.
- Create a chat on telegram
- Add the created bot as a user to the chat and grant it administrator rights.
- Launch the production
- Add another user to the chat - you will see a greeting from IRIS.
- Write something in the chat - you will see the echo from IRIS.
- Send .png file to the chat - if telegram can create a preview for this file, you will see this preview
Use telegram bot @BotFather. Use the /newbot
command to create a new bot - you will receive a token (token example 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw). Read more here https://core.telegram.org/bots/features#botfather.