GithubHelp home page GithubHelp logo

grantharris / banger-bot Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 24 KB

This project is a WhatsApp Bot that listens for Spotify track URLs in WhatsApp group messages and adds them to specified Spotify playlists. The bot can handle multiple chat-to-playlist mappings and is designed to run in a Docker container.

License: MIT License

Dockerfile 7.06% JavaScript 84.19% Makefile 6.87% HTML 1.89%
spotify spotify-api whatsapp whatsapp-bot

banger-bot's Introduction

banger-bot

Introduction

This project is a WhatsApp Bot that listens for Spotify track URLs in WhatsApp messages and adds them to specified Spotify playlists. The bot can handle multiple chat-to-playlist mappings and is designed to run in a Docker container.

Prerequisites

Before you begin, ensure you have the following:

  • Docker installed on your system.
  • A Spotify Developer account and a registered Spotify application to obtain your client ID and client secret.
  • A WhatsApp account for setting up the bot.

Setup

1. Environment Variables

Set up your environment variables by creating a .env file in the root directory of your project with the following variables:

SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
SERVER_ADDRESS=http://localhost
SERVER_PORT=your_server_port
CHAT_PLAYLIST_MAP='{"ChatName1":"PlaylistID1","ChatName2":"PlaylistID2"}'

Replace your_spotify_client_id, your_spotify_client_secret, your_server_port, ChatName1, PlaylistID1, ChatName2, and PlaylistID2 with your actual Spotify application details, server port, chat names, and corresponding Spotify playlist IDs.

2. Building the Docker Container

To build the Docker container for the bot, run the following command in the root directory of your project:

make build

This command will execute the build target in the Makefile, which builds the Docker image for the bot.

3. Running the Bot

To run the bot, execute the following command:

make run

This will start the bot in a Docker container with the environment variables loaded from the .env file.

4. Authorize Your Accounts Via Web Interface

  1. Open the Web Interface:

    • Navigate to http://localhost:your_server_port in your web browser. Replace your_server_port with the port number you set in your .env file.
    • This will open the web interface for the Banger-Bot.
  2. Scanning the WhatsApp QR Code:

    • Upon opening the web interface, you will see a QR code displayed on the screen.
    • Open WhatsApp on your phone and go to 'WhatsApp Web' in the settings menu.
    • Use your phone to scan the QR code displayed on the web interface.
    • Once scanned, the bot will be authenticated and connected to your WhatsApp account.
  3. Authorizing Spotify Access:

    • Below the WhatsApp QR code, you'll find a link labeled "Login to Spotify".
    • Click on this link to be redirected to the Spotify authorization page.
    • Log in to your Spotify account and authorize the bot to access your Spotify data as required.
    • After successful authorization, you will be redirected back to the bot's web interface, and the bot will have the necessary permissions to add tracks to your Spotify playlists.

4. Using the Bot

Send spotify track URLs to your WhatsApp chats. The bot will automatically add the tracks to the corresponding Spotify playlists based on your chat-to-playlist mappings.

5. Additional Commands

To run the container interactively with a terminal: make run-interactive To stop the container: make stop To remove the container: make remove To remove the Docker image: make remove-image To start a stopped container: make start To restart the container: make restart To view container logs: make logs

Usage

Send a WhatsApp message containing a Spotify track URL to the bot. The bot will automatically add the track to the specified Spotify playlist.

Troubleshooting

If you encounter any issues, refer to the container logs for more information. Ensure that your .env file is correctly set up with valid Spotify credentials.

Contributing Feel free to fork this repository and submit pull requests for improvements.

License MIT

banger-bot's People

Contributors

grantharris avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.