jqbx-issues
jqbx-issues copied to clipboard
API
I want to make a slack bot for my slack channel that says what's playing and link to our room, how hard would it be to implement a simple rest api to do this??
@JasonZigelbaum also right now we have 2 chats going, one on slack and one on jqbx. It would be awesome to be able to integrate slack so you could integrate the built in chat with a slack channel.
this would be amazing. id be happy to help on this...
I'm currently listening in my room alone 'cos everyone has forgotten the room exists (or maybe i'm a bad DJ!) Having the current track (or 'Joe Bloggs is now a DJ') print out in out in our slack #nowplaying channel would mean loads more users
Hey sorry for not responding earlier! I agree this would be a worthwhile undertaking and I will definitely build out an API. I'm currently heads down on releasing the Android app but that should be done in a week from today.
So next week I'll get started on the public API and ping both of you once it's nearly completed to make sure it contains all the endpoints you need to build the tools you want.
hi dude! I was thinking about this.... rather than building out a full api to support this, a webhook-type feature might be a lot less work for you and for the user. You could include a slack button in the admin settings for the room. One click setup for the user, and a lot less work for you :)
Brilliant service. Any update on the api situation?
Any updates on public api and/or slack integration? Would love to get a room going for our office and integrate it into a slack channel so you can see what's playing
@JasonZigelbaum Any update on this? A public API would be very useful.
@JasonZigelbaum Also would love a public API. One of the engineers at my company created their own bot that we have used for years. I would like to move over to JQBX but we really love the current slack integration.
Right now when someone is a DJ using our in-house application, a slack thread gets created in the #jukebox slack channel. Each new song is added as a reply to the thread.
I could see a use for individual messages, or even setting channel topic to the current song.
Any response is better than silence..
yeah im still waiting for this! Our nowplaying channel would have 30 users in it, as it is, it starts off well, and then tends to 0 because people forget about it. Please let us send a webhook to slack! Or open the code so we can build it for you!
Hey sorry about the silence on this. I want to do it but it's tricky to make a public API because I would then need to monitor what everyone's doing with it to ensure I stay within the Terms and Services agreement.
@dayglo what functionality would you need in particular to integrate with your Slack channel? I think if it's a smaller scope I might be able to something done quickly. Feel free to send me an email w/ details if it's easier.
Hi Jason! Thanks so much for getting back to us!
The functionality you'd need to create would be:-
UI
- Create a field in the admin settings UI, into which the user would paste their 'incoming slack webhook' URL.
- you could validate it in the UI if you like, it'll look something like this, with T00000000, B00000000 , XXXXXXXXXXXXXXXXXXXXXXXX being different for each user's webhook:
- https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
- Create another field for 'channel name' (default: '#nowplaying')
- Create another field for 'icon emoji' (default: ':musical_note:' )
- Create another field for 'username' (default: 'JQBX' )
- Add a checkbox to enable and disable each type of update:
- New DJ
- New song played
Backend
New DJ
In the backend method that runs when you add a new DJ, just make an HTTP POST (with content type application/json) to the URL the user entered, sending this object-
{ "text": "USER has become a JQBX DJ! \nJoin our room <ROOMURL|here>, to listen or to go back to back with the other DJs!", "channel": "#CHANNELNAME", "link_names": 1, "username": "USERNAME", "icon_emoji": "ICONEMOJI" }
- with ROOM, ROOMURL, CHANNELNAME, USERNAME and ICONEMOJI replaced with the data the user provided in the admin settings:
- with USER replaced with the JQBX username.
New song played
In the backend method that runs when you start a new song, just make an HTTP POST (with content type application/json) to the URL the user entered, sending this object
{ "text": "USER played SONGNAME by ARTIST. \nJoin our room <ROOMURL|here> ", "channel": "#CHANNELNAME", "link_names": 1, "username": "USERNAME", "icon_emoji": "ICONEMOJI" }
- with ROOM, ROOMURL, CHANNELNAME, USERNAME and ICONEMOJI replaced with the data the user provided in the admin settings;
- with the name of the song and artist in SONGNAME, ARTIST;
- with USER replaced with the JQBX username.
The documentation for all this stuff is at https://api.slack.com/incoming-webhooks
Id be happy to help you test or write this :)
George
To add to this: We currently use a bot that was created by an engineer. We have our songs go to a slack thread so the channel is not cluttered with constant song notifications. Would be great if for every DJ, there was a message thread with the songs played. New DJ = New Thread. Message threads do not alert the entire room for every song so there is way less noise for end users.
I also use Zapier for a bunch of my API calls, you could even do a simple webhook and allow us to set the url. We can then send it off directly to slack or to Zapier.
Any update on this?
To add to this: We currently use a bot that was created by an engineer. We have our songs go to a slack thread so the channel is not cluttered with constant song notifications. Would be great if for every DJ, there was a message thread with the songs played. New DJ = New Thread. Message threads do not alert the entire room for every song so there is way less noise for end users.
@zachamato , is the code for your bot open? We've decided to have another go at setting up a work jukebox so all our remote engineers can listen together, but without any slack integration jqbx just isnt going to work.
ah. i found this https://github.com/mcicoria/jqbx-bot-plugins
@mcicoria are there any contribution guidelines? Is there somewhere i can store an api secret so that i can send events out to slack when that.bot.emit fires?
Hey, sorry for the delay. No easy place to store secrets at the moment, but what I can do is add it to the Google Form and I'll store it in the bot's record. As for contributions, this one should be a good template / starting point.
You'll be able to access the Slack hook via: data.bot.pluginConfig.slack.hook
@mcicoria I have submitted a request for the bot in the past, and again this morning. Any chance you can help there so I can mess around with the Slack hook.
Seems like the API here is not something that will be implemented.