JasonZigelbaum / jqbx-issues

Post your issues with JQBX in the issues tab.
39 stars 1 forks source link

API #34

Open lazopm opened 7 years ago

lazopm commented 7 years ago

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 commented 7 years ago

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

dayglo commented 7 years ago

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

dayglo commented 7 years ago

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

JasonZigelbaum commented 7 years ago

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.

dayglo commented 6 years ago

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

derekforeman commented 6 years ago

Brilliant service. Any update on the api situation?

ryandolen commented 6 years ago

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

obanks commented 6 years ago

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

zachamato commented 6 years ago

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

clounie commented 6 years ago

Any response is better than silence..

dayglo commented 6 years ago

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!

JasonZigelbaum commented 6 years ago

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.

dayglo commented 6 years ago

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.

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" }

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" }

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

zachamato commented 6 years ago

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.

michaelpelletier commented 6 years ago

Any update on this?

dayglo commented 5 years ago

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 commented 5 years ago

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?

mcicoria commented 5 years ago

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

zachamato commented 5 years ago

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