{"id":20186703,"url":"https://github.com/azeemidrisi/tweetifymusic","last_synced_at":"2026-04-15T23:31:41.424Z","repository":{"id":177590525,"uuid":"660591018","full_name":"AzeemIdrisi/TweetifyMusic","owner":"AzeemIdrisi","description":"A Twitter Bot that utilizes GitHub Actions to automatically tweet your recently played song on Spotify on a manually scheduled basis.","archived":false,"fork":false,"pushed_at":"2023-07-13T20:58:19.000Z","size":65,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T20:47:04.032Z","etag":null,"topics":["automation","github-actions","python-bot","spotify-api","spotify-bot","spotipy","tweepy","tweet","twitter-api","twitter-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AzeemIdrisi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"AzeemIdrisi","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-06-30T11:00:00.000Z","updated_at":"2024-09-15T22:11:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"3732b6f3-7fd4-4f1d-9303-ec7dfb66c87c","html_url":"https://github.com/AzeemIdrisi/TweetifyMusic","commit_stats":null,"previous_names":["azeemidrisi/tweetifymusic"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AzeemIdrisi/TweetifyMusic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzeemIdrisi%2FTweetifyMusic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzeemIdrisi%2FTweetifyMusic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzeemIdrisi%2FTweetifyMusic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzeemIdrisi%2FTweetifyMusic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AzeemIdrisi","download_url":"https://codeload.github.com/AzeemIdrisi/TweetifyMusic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzeemIdrisi%2FTweetifyMusic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31864970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","github-actions","python-bot","spotify-api","spotify-bot","spotipy","tweepy","tweet","twitter-api","twitter-bot"],"created_at":"2024-11-14T03:18:18.155Z","updated_at":"2026-04-15T23:31:41.402Z","avatar_url":"https://github.com/AzeemIdrisi.png","language":"Python","funding_links":["https://github.com/sponsors/AzeemIdrisi","https://www.buymeacoffee.com/AzeemIdrisi"],"categories":[],"sub_categories":[],"readme":"# TweetifyMusic\n### GitHub Actions based Twitter Bot\n\n![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/AzeemIdrisi/TweetifyMusic/main.yml?logo=github)\n![Static Badge](https://img.shields.io/badge/python-3.11-blue?logo=python\u0026logoColor=white)\n\nTweetifyMusic is a Twitter bot that automatically tweets your recently played song on **Spotify** on a manually scheduled basis using **GitHub Actions**. It leverages the Twitter and Spotify APIs to fetch the latest played song from Spotify and post it on your Twitter account.\n\n## Features\n\n- **Automated tweeting:** TweetifyMusic connects to your Spotify account and retrieves the most recently played song. It then automatically tweets the song details on your connected Twitter account.\n\n- **Manual scheduling:** You have full control over when the tweets are posted. You can manually schedule the tweets according to your preference using GitHub Actions.\n\n- **Twitter and Spotify API integration:** TweetifyMusic uses the Twitter API to post tweets and the Spotify API to fetch your recently played songs. The integration allows for seamless communication between the two platforms.\n\n\n\n\n## Getting Started\n\n### Prerequisites\n\nTo run TweetifyMusic locally, you'll need the following:\n\n- **Python3** installed on your machine\n- Python libraries: [`spotipy`](https://github.com/spotipy-dev/spotipy) and [`tweepy`](https://github.com/tweepy/tweepy)\n- **Twitter API** credentials (API key, API secret key, Access token, Access token secret, Bearer token)\n- **Spotify API** credentials (Client ID, Client Secret)\n\n### Getting the Spotify refresh_token\n\n1. Clone this repository to your local machine:\n\n   ```\n   git clone https://github.com/AzeemIdrisi/TweetifyMusic.git\n   ```\n\n2. Navigate to the project directory:\n\n   ```\n   cd TweetifyMusic\n   ```\n\n3. Install the required dependencies:\n\n   ```\n   pip install spotipy tweepy\n   ```\n\n4. Set up Spotify API credentials:\n\n   - Obtain your **Spotify API credentials** by creating a **Spotify Developer Account**, registering a **new app**, and using a **Redirect URI** - `http://127.0.0.1:8080/callback`. Make sure to retrieve the **Client ID** and **Client Secret** and store them in a secure text file.\n\n5. Edit the **get_refresh_token.py** file:\n\n   - Paste the Client ID and Client Secret in this file and run the file:\n      ```\n      python3 get_refresh_token.py\n      ```\n   - A webpage for Spotify App Authorization will open. Approve it.\n   - Store the **refresh_token** in a secure text file.\n\n### Testing TweetifyMusic on your local machine\n\n1. Set up Twitter API credentials:\n    - Obtain your **Twitter API credentials** by creating a **Twitter Developer Account** and creating a **new app**. Note down the **API key, API secret key, Bearer token, Access token, and Access token secret**.\n\n2. Edit the **tweetifymusic.py** OR Export **environment variables**:\n\n   - For running TweetifyMusic locally, you have **2 choices**. Follow whichever you find easier:\n      - **Option 1** - Edit the **tweetifymusic.py**:\n         - Replace `os.environ[\"KEY_NAME\"]` with your API credentials as strings.\n         - For example:\n         \n             Change `client_id = os.environ[\"SPOTIFY_CLIENT_ID\"]`\n           to `client_id = \"123yiuh47fguyer47546562c8476865485644bghf78\"`\n    \n      - **Option 2** - Export API keys as **environment variables**:    \n         - To keep the API credentials private, export the credentials as environment variables in your system.\n         - Add all your keys in your .zshrc/.bashrc by adding these lines at the end. (**Note**: Do not use double quotes with keys)\n           \n          ```\n         export SPOTIFY_CLIENT_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n         export SPOTIFY_CLIENT_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXX\n         export TWITTER_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n         export TWITTER_API_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n         export TWITTER_BEARER_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXX\n         export TWITTER_ACCESS_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n         export TWITTER_ACCESS_TOKEN_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n         export SPOTIFY_REFRESH_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n           ```\n          \n     - Replace the placeholder values with your actual API credentials.\n\n3. Run the bot:\n\n   ```\n   python3 tweetifymusic.py\n   ```\n\n   The bot will fetch your recently played song from Spotify and post it on Twitter.\n   \n   \u003e If TweetifyMusic manages to tweet your recently played song on Spotify when run on a local machine, then you can proceed to set up the GitHub Action to automate it.\n   \n## Setting up TweetifyMusic GitHub Action\n\nSchedule the tweets using **GitHub Actions**:\n\n- Fork this repository to your GitHub account.\n- Add the Spotify and Twitter API credentials as **new secrets** in your repository.\n  \nYou can find this in your repository under:\n\nRepository Settings -\u003e Security -\u003e Secrets and Variables -\u003e Actions -\u003e **New repository secret**.\n\nNow add all your API credentials one by one with the following names:\n\n| Name  | Secret (without double quotes) |\n| ------------- | ------------- |\n| SPOTIFY_CLIENT_ID  | Paste your API credential here without quotes |\n| SPOTIFY_CLIENT_SECRET | Paste your API credential here without quotes |\n| SPOTIFY_REFRESH_TOKEN | Paste your API credential here without quotes |\n| TWITTER_ACCESS_TOKEN  | Paste your API credential here without quotes |\n| TWITTER_ACCESS_TOKEN_SECRET |  Paste your API credential here without quotes |\n| TWITTER_API_KEY |  Paste your API credential here without quotes |\n| TWITTER_API_SECRET  | Paste your API credential here without quotes |\n| TWITTER_BEARER_TOKEN  | Paste your API credential here without quotes |\n\nYour repository secrets should look like this screenshot -\n![image](https://github.com/AzeemIdrisi/TweetifyMusic/assets/112647789/35a832d2-2249-4ae9-b39d-2ebbfcdea81d)\n\nThis will save your API credentials which are only visible to you.\n\n- The default workflow will run once every 24 hours. To change it, edit the **TweetifyMusic/.github/workflows/main.yml** and edit `- cron: '0 */24 * * *'`.\n\n- Go to the **Actions** tab of the repository and run the workflow.\n  \n## Contributing\n\nContributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the GPL-3.0 License. See the [LICENSE](LICENSE) file for details.\n\n## Acknowledgements\n\n- This project was inspired by the desire to share your favorite music with your Twitter followers effortlessly.\n- Thanks to the creators and maintainers of the Twitter API for Python [tweepy](https://github.com/tweepy/tweepy) and the Spotify API for Python [spotipy](https://github.com/spotipy-dev/spotipy) for providing the necessary tools to develop this bot.\n\n\n# Developer\n\n\u003ca href=\"https://github.com/azeemidrisi/\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=azeemidrisi/tweetifymusic\" /\u003e\n\u003c/a\u003e\n\n\n**Mohd Azeem** - [@AzeemIdrisi](https://github.com/azeemidrisi/)\n \n\n# Support Me\n\n\u003ca href=\"https://www.buymeacoffee.com/AzeemIdrisi\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"41\" width=\"174\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazeemidrisi%2Ftweetifymusic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazeemidrisi%2Ftweetifymusic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazeemidrisi%2Ftweetifymusic/lists"}