How do I configure a Telegram bot for Spidermon?

What are bots?

A bot is a type of Telegram user designed to interact with users via conversation.

To work with Telegram Actions, you will need a Telegram bot which would send notifications to Telegram from Spidermon.

Steps

  1. Create a Telegram bot.
  2. Once your bot is created, you will receive its Authorization Token. This Bot Authorization Token is what we use for SPIDERMON_TELEGRAM_SENDER_TOKEN.
  3. Add your Telegram bot credentials to your Scrapy project’s settings.
  4. Add the recipients to your Scrapy project’s settings, getting the chat_id or group_id is not straightforward, there is an info bot that can help with this. Just forward a message from the user or group that you want to receive Spidermon notifications to [@GroupIDbot](https://t.me/GroupIDbot) and it will reply with the id. To forward a message from a group to the bot, you need to add the bot to that group before.
  5. For notifications in groups: Add your self-created bot (from step 1.) to your group. For notifications in channels: Add your self-created bot (from step 1.) as administrator to your channel (not possible in browser version).
# settings.py
SPIDERMON_TELEGRAM_SENDER_TOKEN = 'YOUR_BOT_AUTHORIZATION_TOKEN'
SPIDERMON_TELEGRAM_RECIPIENTS = ['chat_id', 'group_id', '@channelname']