project journal

18-03-13 webhooks are hard

18-03-06 a bot for sounds

Soundbot is a Telegram chatbot that turns online song and music video links into a neatly catalogued mp3 collection.

what it does

Soundbot parses urls from media services around the web like YouTube, Soundcloud, Vimeo and many others, and extracts their audio tracks.

Just drop a link from pretty much any media source into a conversation with the bot and it will download it, turn it into an mp3 and try to tag it according to its contents and metadata.

The mp3 file is then uploaded to Dropbox, and the bot will ping you to let you know you song is ready to be listened to.

how to use it

To use Soundbot, you must deploy your own instance of it. First, make sure you meet the prerequisites below:

  1. Sign up to Amazon Web Services
  2. Set up the AWS CLI tool
  3. Create a Dropbox App and give it write permissions
  4. Add the app to your Dropbox account
  5. Create a Telegram Bot
  6. Find out your chat id by sending /my_id to @get_id_bot

When you’re ready, clone the Soundbot repo at:

Inside the config directory, rename the config.json.example file to config.json and fill in your Telegram bot token, Telegram chat id and Dropbox app token.

Then, in the scripts directory, run the scripts package and deploy scripts, in that order. When those are done, your bot will be ready to be used. Enjoy!

how it works

By harnessing the power of the youtube-dl library, and the serverless nature of AWS Lambda, Soundbot only springs to life when it’s needed.

Whenever the bot receives a message, it starts a microservice-like process, with the message’s contents passed as a parameter. If the message contains a link to one of its many supported sites, Soubot will download the media, convert it to mp3, and add metadata as best as it could infer from the source.

Once the conversion is done, a call is made to the Dropbox API, uploading the mp3 file to a connected cloud folder.

More info about Soundbot here: