Spotigen, a Chat GPT Plugin
A plugin for Chat GPT that allows you to generate Spotify playlists based on your mood.
Installation
- Go to ChatGPT
- Go to:
Plugin Store
>Install an unverified plugin
- Enter the following domain: spotigen.vercel.app
- OpenAI will warn you that the plugin is unverified. Click
Continue
. - Click
Login with Spotigen
. - Now you're ready to use the plugin!
Setup development environment
Setup a Spotify app
To integrate ChatGPT with Spotify API via OAuth, you have to set up a Spotify app in the Spotify Developer Dashboard
and obtain your client_id
and client_secret
:
-
Go to Spotify developer's dashboard and click "Create app".
-
Enter an App name and App description.
-
For the Redirect URI, put
https://chat.openai.com/aip/plugin-id-temporary-value/oauth/callback
as a temporary value, then you will need to replace it later once you obtain your plugin ID. -
Accept the terms and conditions and click "Create".
Setup the plugin
To install the required packages for this plugin, run the following command:
pip install -r requirements.txt
To run the plugin, enter the following command:
uvicorn main:app --reload
Setup ngrok
To test your plugin locally, you will need to use ngrok to provide HTTPS access to your local server.
- Download ngrok from here and unzip it.
- Run the following command to expose your local server to the internet:
./ngrok http 8000
- It's important to note that you will need to have a ngrok paid plan to bypass the ngrok-skip-browser-warning.
Setup the plugin in ChatGPT
Once the local server is running:
- If you are a ChatGPT Plus user, you will be able to access the Plugins option. Otherwise, you will need to sign up for the waitlist.
- Go to: Plugin Store > Develop your own plugin
- Enter your ngrok domain: <ngrok_id>.ngrok.app
- Enter
client_id
andclient_secret
from your Spotify app. - ChatGPT will provide you a verification token. Update it in your
ai-plugin.json
as follows:
{
"verification_tokens": {
"openai": "<open_ai_verification_token>"
}
}
- Click
Install for me
. - Click
Log in with Spotigen (DEV)
. - You will see a page with
INVALID_CLIENT: Invalid redirect URI
error. Copy theplugin_id
from the URL and update theredirect_uri
in your Spotify app settings. - Reload the error page and you will be redirected to the ChatGPT app.
Note
Personally, I don't have a paid ngrok
account, so I use my spotigen.vercel.app
URL directly within ChatGPT for my whole development process.
Usage
Once the plugin is installed, you'd like to try the following prompts:
Purpose: Tell how you are feeling and get a playlist that matches your mood.
Prompt 1: "I'm feeling a bit tired today and in a mood for some nostalgia. Could you create a playlist featuring the best English pop songs from the 2010s?"
Prompt 2: "I'm feeling happy today and would like a playlist that reflects my mood. Could you generate one with all English songs?"
Purpose: Create playlists based on different scenarios and inspirations.
Prompt 1: "I have a photo of a family vacation at a pool with a blue background that I'd like to post on Instagram. Could you create a playlist that would complement this image? I'm looking for a playlist suitable for a family vacation photo taken at a pool with a blue background."
Prompt 2: "I'm planning a trip to a place with abundant greenery and would like to feel as if I'm on a summer trip in 2017. Could you create a playlist to match this mood? I want the playlist to evoke the feeling of a summer trip in a lush green location reminiscent of the summer of 2017."
Purpose: Create a playlist based on your favorite playlist/artist.
Prompt 1: "I have a favorite playlist named 'Chill Vibes' that I absolutely love and listen to all the time. Could you create a new playlist inspired by my 'Chill Vibes' playlist? I want to discover similar songs and artists that I might enjoy."
Prompt 2: "There's this one artist named 'John Smith' who is my absolute favorite, and I can't get enough of their music. Could you curate a playlist based on 'John Smith's' style and genre? I'm looking to explore more songs that resonate with their sound."