BotCast is a Telegram bot that can be use to broadcast an input in various channels.
It helps if you spend a lot of time copy/pasting the same information in various groups/channels.
You can use this bot by sending it, for example, an interesting link. It'll answer your with an inline keyboard with the possible destination where you'd want to broadcast this interesting link.
It reduces multiple copy/paste in a simple inline keyboard.
It'll also save a csv file containing the history of the interaction with this bot.
yarn install
cp config.js.sample config.js
You must create a .env
file and setup your tokens.
For example:
TELEGRAM_TOKEN=233429842:dwdwedkjewfowfeoeifjwfjwfe
SLACK_TOKEN=kdiru-23832749873492834-34889327498320234987283749893d329828
- To create a Telegram Token, create a new bot with @BotFather
- To create a Slack Token, connect to your Legacy Token page
config.js
file must be filled with your informations.
- config.owner : your telegram login, you'll be the only one able to speak to your bot
- config.backup_file : path to your csv backup file
You can setup broadcast connectors in config.js
.
- text : text that will be displayed on the inline keyboard
- callback_data : unique id for this connector, it will be saved in the backup file
- broadcast_method : method used to broadcast this message, only
telegram
available at the moment - chat_id : if
broadcast_method = telegram
, this variable is used to select the channel where the message will be sent - row : row position on the inline keyboard
If you need to configure a Telegram broadcast_method
, you will need the chat_id
corresponding to the channel where you want to broadcast your information.
To get this id, invite your bot in the selected channel, then send this comment in the channel: /get_id
The bot will answer with the channel chat_id
and you can fill this information in your config.js
file.
- Add
@BotFather
in your Telegram contact list - Create a new bot with command:
/newbot
- Give it a name and an username
@BotFather
will give you a token to access the HTTP API
- Create a
.env
file at the root of your BotCast code - Fill it with the previous token like this:
TELEGRAM_TOKEN=@BotFather_given_token
- Edit
config.js
owner with your Telegram username
You can now start the bot with this command in BotCast root path: yarn start
- Invite the bot to a channel you'd like to broadcast to
- When the bot is added to this channel, type this command inside the channel:
/get_id
- The bot will answer you with an integer, it's the chat_id of this channel
- Fill the
config.js
connectors section with a new connector:
{
text: 'my favorite channel',
callback_data: 'broadcast_to_favorite_channel',
broadcast_method: 'telegram',
chat_id: replace_with_correct_chat_id,
row: 0
}
- You must restart the bot process
- Create an incoming webhook for the channel you want to broadcast to: incoming webhook integration
- Fill the
config.js
connectors section with a new connector:
{
text: 'my favorite channel',
callback_data: 'broadcast_to_favorite_channel',
broadcast_method: 'slack',
web_hook: ' https://hooks.slack.com/services/YOUR_CUSTOM_WEBHOOK_URL',
channel: '#channel_where_to_broadcast_to',
bot_name: 'bot username',
row: 0
}
- You must restart the bot process
- Create a bot with access to your Discord server, and get the token: Creating a discord bot & getting a token
- Get the
channel_id
of the channel you want to broadcast to in the url of your web browser when you are connecting to this channel: https://discordapp.com/channels/1234567890 - Fill the
config.js
connectors section with a new connector:
{
text: 'my favorite channel',
callback_data: 'broadcast_to_favorite_channel',
broadcast_method: 'discord',
token: 'YOUR_BOT_TOKEN',
channel_id: '1234567890',
row: 0
}
- You must restart the bot process