jqbx-issues icon indicating copy to clipboard operation
jqbx-issues copied to clipboard

API

Open lazopm opened this issue 7 years ago • 19 comments

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??

lazopm avatar Jun 19 '17 15:06 lazopm

@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.

lazopm avatar Jun 19 '17 15:06 lazopm

this would be amazing. id be happy to help on this...

dayglo avatar Sep 08 '17 08:09 dayglo

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

dayglo avatar Sep 13 '17 10:09 dayglo

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.

JasonZigelbaum avatar Sep 13 '17 13:09 JasonZigelbaum

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 :)

dayglo avatar Oct 25 '17 13:10 dayglo

Brilliant service. Any update on the api situation?

derekforeman avatar Feb 02 '18 20:02 derekforeman

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

ryandolen avatar Apr 06 '18 20:04 ryandolen

@JasonZigelbaum Any update on this? A public API would be very useful.

obanks avatar May 02 '18 07:05 obanks

@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.

zachamato avatar May 17 '18 15:05 zachamato

Any response is better than silence..

clounie avatar May 17 '18 15:05 clounie

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!

dayglo avatar May 18 '18 16:05 dayglo

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.

JasonZigelbaum avatar May 18 '18 20:05 JasonZigelbaum

Hi Jason! Thanks so much for getting back to us!

The functionality you'd need to create would be:-

UI

  1. 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
  2. Create another field for 'channel name' (default: '#nowplaying')
  3. Create another field for 'icon emoji' (default: ':musical_note:' )
  4. Create another field for 'username' (default: 'JQBX' )
  5. 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

dayglo avatar May 19 '18 11:05 dayglo

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.

zachamato avatar May 22 '18 12:05 zachamato

Any update on this?

michaelpelletier avatar Sep 14 '18 17:09 michaelpelletier

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.

dayglo avatar Oct 04 '18 14:10 dayglo

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?

dayglo avatar Oct 05 '18 11:10 dayglo

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 avatar Oct 22 '18 07:10 mcicoria

@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.

zachamato avatar Nov 13 '18 13:11 zachamato