Skip to content

theorchard/songwhip-telegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A stateless 'function' endpoint that responds to HTTP events sent by Telegram Clients that are chatting to SongwhipBot directly or have SongwhipBot added to a group.

Tech overview

  • Uses Telegram WebHooks API so that the bot can be hosted in a serverless/Lambda environment, woken-up by inbound requests as opposed to polling for changes.
  • There's a risk this could be an expensive service as it listens to every message send in a group for a music link. We'll monitor it.
  • We opt-out of replying via the original inbound http response (via webhookReply: false) so that we can resolve the request straight away and send a string of follow-up messages after. This makes things simpler when sending more than one message response.
  • The vercel.json defines production env vars, when we deploy to staging with yarn deploy:staging we override select env vars so that the @SongwhipDevBot token is used instead of @SongwhipBot and the staging endpoint songwhip-telegram.wilsonpage.now.sh is used.
  • Some bot configuration (eg. the command list or enabling 'inline' command) must be done from the Telegram app via the @BotFather bot.
  • We're using now secret from the CLi to store the Telegram bot token, which is used in now.json via the magic @songwhip-telegram-bot-token placeholder.

Establishing the webhook endpoint with Telegram

  1. Set the SONGWHIP_TELEGRAM_URL to the URL of the deployment
  2. Deploy
  3. Visit /set-webhook on the deployment to setup the connection between Telegram and the deployment endpoint.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published