🔌 telegram protocol integration for coffea 1.0-beta
Clone or download
omnidan Merge pull request #21 from caffeinery/fix-readme-link
fix link to telegram API reference
Latest commit 04618e7 Oct 30, 2017



telegram plugin for coffea 1.0-beta


  • Make sure to use the latest beta version of coffea by running: npm install --save coffea@beta
  • Install coffea-telegram: npm install coffea-telegram


Specify the telegram protocol in your network config:

  "protocol": "telegram",
  "token": "TOKEN"

coffea will automatically load coffea-telegram when it's needed! Thus, using telegram (or other protocols) this way should work on any coffea project, without any tweaks (other than installing coffea-telegram and specifying the config).

coffea-telegram aims to be compatible with coffea. Of course, features that telegram doesn't have (like joining channels) aren't available for telegram protocols, they will just be ignored.

Special Events

Telegram has some special events that IRC doesn't have, you can listen to them just like listening to messages and other events:

networks.on('EVENTNAME', (event, reply) => {

The following events are available: text, audio, document, photo, sticker, video, voice, contact, location, new_chat_members, left_chat_member, new_chat_title, new_chat_photo, delete_chat_photo, group_chat_created, callback_query, inline_query, chosen_inline_result, edited_message, edited_message_text, edited_message_caption

If you want to use inline queries, make sure to enable inline mode.

For some example bots, check out the coffea-bots organisation for existing bots, or the coffea-starter repo, if you want to create your own bot.

Telegram API

You can use:

  type: 'FUNCTION_NAME',

to access the telegram api. All arguments have the same names, except chatId has been changed to chat to be consistent with other coffea protocols and allow reply to work.

Here is an example:

  type: 'getMe'
  me => console.log(me)