Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach to event source other than express #81

Closed
barlock opened this issue Apr 11, 2017 · 9 comments
Closed

Attach to event source other than express #81

barlock opened this issue Apr 11, 2017 · 9 comments
Labels
enhancement M-T: A feature request for new functionality

Comments

@barlock
Copy link
Contributor

barlock commented Apr 11, 2017

I would like to use Slapp in a serverless environment. In doing so, I'm not actually ever running a real http server, all I have is the data from Slack's event api.

This would be fairly easy to hook up by just calling slapp.reciever.emit("message", msg) after building it, but I would like to have a supported way to pass in data and get it into slapp.

I imagine this would look like:

function eventReciever(data) {
    slapp.sendEvent(data)
}

This would take care of calling context, building the Message and sending it through Slapp.

@mbrevoort
Copy link
Contributor

Really good point. What would you expect for format for data to be? Would you expect to have separate functions for each type of Slack request (event, slash command, action, options) or a single handler that would infer which one of those it is and emit from there?

@selfcontained
Copy link
Contributor

Could data just be the body sent from slack? I would think a single function you just pass that into and let slapp route it regardless of its a slash command or from the event API would be the nicest developer experience, but am remembering all the nuances with different slack payloads for different types and wonder how much of an issue that might be.

@barlock
Copy link
Contributor Author

barlock commented Apr 12, 2017

Yes I was thinking it would be the data that slack posts to you. Basically the result of JSON.parse(res.body). A single function would be nice, but after looking through reciever/middleware/parse-* I think having one function per type would probably make the most sense. Otherwise you'd be relying on the data object to be a formatted version of the POST data.

@mbrevoort
Copy link
Contributor

Trickiest part is that Slash commands are urlencoded, Events are application/json and actions are urlencoded json.

https://www.youtube.com/watch?v=-XSC_UG5_kU

@barlock
Copy link
Contributor Author

barlock commented Apr 15, 2017

Yeah that was certainly nice of them 😛. After thinking through this a bit, I think it's probably best to have 1 function per event type (event, slack, action, options) rather than inferring the event type which could get sketchy.

I also think that, given this is a more generic handler that is abstracted away from the requests coming in, that dealing with the Content-type should be up whatever is dealing with that and have these functions take the POST data converted to JSON. That should be in line with most systems.

@simonsayscode
Copy link
Contributor

I also have interest in this. My goal was to create a serverless slack framework but I ended up just prototying and sticking with the default express app.

@selfcontained
Copy link
Contributor

Totally, will make some time to check out that PR, been swamped lately but really want to see this feature added.

@selfcontained selfcontained added the enhancement M-T: A feature request for new functionality label Apr 29, 2017
@Vlaaaaaaad
Copy link

Any updates on this?

@seratch
Copy link
Member

seratch commented Mar 18, 2021

I'm sorry to say, but the maintainers of this project (bolt-js) no longer support the slapp library. Please let us close this issue now.

@seratch seratch closed this as completed Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement M-T: A feature request for new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants