In my Florence Bot project, I wanted a way to quickly access the StreamElements Song Request API to do a few things
- Show the current playing song with a
!song
command - Show a list of songs in the queue (
!queue
) - Show a list of songs that have already played (
!history
)
If you open a new tab, open the console and go to your mediarequest page,
(e.g. streamelements.com/deanpcmad/mediarequest), you should see a a few different
requests to api.streamelements.com
The ones we want to look for end with:
/playing
/queue/public
/history?limit=25
These URLs will have your account token so you’ll need to replace
ACCOUNT-TOKEN
in the examples below with your account token
Currently Playing
For the current playing song, you’ll need to make a GET request to
https://api.streamelements.com/kappa/v2/songrequest/ACCOUNT-TOKEN/playing
If there is something playing then the response will be something like this:
Queue
For a list of songs in the queue, you’ll need to make a GET request to
https://api.streamelements.com/kappa/v2/songrequest/ACCOUNT-TOKEN/queue/public
If there is something playing then the response will be something like this:
History
For a list of songs that have played, you’ll need to make a GET request to
https://api.streamelements.com/kappa/v2/songrequest/ACCOUNT-TOKEN/history
You can add ?limit=25
to limit the amount of songs that are returned.
If there is something playing then the response will be something like this: