-
Notifications
You must be signed in to change notification settings - Fork 399
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
RFC: Slapp v4.0 Proposal #119
Comments
I have a couple of open questions that I want to work on developing further as well:
|
The various proposed changes for both core framework and developer experience are great. Especially like the generalized receiver to make it easier for attaching to other non-Express architectures as well as the migration to Slack's library for api calls. Msg shape: agree that having a cleaner separation of raw to library added would make sense - especially if with a proposed new middleware section, that would create a standardized place for injected data to live. Re: middleware signatures, I like the (msg: object, next: function) as it resembles express middleware signatures. Haven't seen the addition of a done: function before. Is there a pattern or other library that that's common so I can see how it's been used? |
Some considerations came up when thinking through the middleware design... Acknowledging eventsTo ensure a consistent user experience in the Slack client, some types of events need to be acknowledged (generally within 3 seconds). This includes all actions, commands, and options requests. A possible way to handle this is by passing an
An app would need to call |
Is there a default 200 response/ack already sent in these timeouts? https://github.com/MissionsAI/slapp/blob/a47628a0df9a92013629509c14446544bc7975d0/src/message.js#L109 Various event type parsing all set their response timeout in similar fashions: https://github.com/MissionsAI/slapp/blob/aa0217f9b6763ffbb4c35ac39fc230c92ab7679d/src/receiver/middleware/parse-command.js#L25 If it doesn't necessarily send back a response, I believe it then defaults to using the response_url for future responding to messages and it doesn't seem to affect functionality (other than ack'ing a dialog). Or are you proposing logging an informative error regardless just to ensure the best practice of speedy response time and to identify bottlenecks/slow areas? |
@simonsayscode Including this kind of response timeout causes some tricky edge cases. For example, what if your network latency causes your app to receive requests in While we may be able to default back to using the Overall, it's just much more deterministic and leads to better UX to ask all developers to call |
Background
As a result of the Missions acquisition, two of Slapp's two core contributors began working on other projects. After sitting down with @mbrevoort and @selfcontained, we determined that it’s worthwhile for the developer community to invest Slack’s resources into supporting and maintaining the Slapp project and community.
We started by triaging the open issues on the Slapp repository and looking at changes (small and large) that we saw important to address in the next major version of the framework. We came up with a few different focus areas where we see important, outstanding work to be addressed:
Core framework
Goals
Proposed changes
payload: object
(aliasesmessage
,event
) - The contents of the event. The exact structure will depend on which type of event this listener is attached to.context: object
- The event context. This object contains data about the message and the app.say?: (string|object)
- A function to respond to an incoming event. Only available when the listener is triggered for an event that contains achannel_id
. Accepts simple strings and message objects.ack?: (string|object|undefined)
- A function to acknowledge that an incoming event was received by the app. This is detailed in more detail in a comment below on this issue.respond?: (string|object)
- A function to respond to an incoming event. It's only available when the listener is triggered for an event which contains aresponse_url
.body: object
- An object that contains the whole body of the event, which is a superset of the data inside ofpayload
. It's rarely needed, but contains data likeapi_app_id
andauthed_users
.A listener function may now look something like this:
subtype
. With that in mind, one solution is offering a default listener middleware that can filter bysubtype
:There can be many implementations of the
Receiver
interface to serve different use cases. For example, the existing receiver in the project would become anExpressReceiver
- and it would still be the default when initializing Slapp. OtherReceiver
implementations (e.g. aLambdaReceiver
,MockReceiver
,WebSocketReceiver
, etc) will dictate how they need to be initialized, including a different set of options.Receiver
s no longer have to deal with thecontext
object. The receiver simply delivers raw event payloads (whose shape is yet to be defined) to Slapp. Then Slapp will apply the context to build the object(s) needed when routing that payload through middleware and handlers.Developer experience
Goals
Proposed changes
Rewrite the documentation, including a Getting Started guide to make it simple to get up and running. There are also examples that no longer work on the README, so make sure all examples work and are up-to-date. (Fixes Demos and README don't work #113 and Getting Started / Slapp Example #114)
Change the client in the framework to the official Node Slack client. Originally, the official Slack client wasn't chosen because it was heavyweight and didn't add much benefit. A few years have passed, and we think the reduction in package size and features like rate limit and retry handling, pagination support, and refresh token support, the official client is in a better place to support most use cases for Slapp.
The logging in Slapp is useful, but is less informative than we think it could be. In some of our other Node packages, we use four labels (
ERROR
,WARN
,INFO
, andDEBUG
) to classify logs for developers. This comes along with more granular control over logging. It's likely that we'd modify the existing logger to work closely to the node-slack-sdk implementation. (Explained more in Add more descriptive logging #118)The text was updated successfully, but these errors were encountered: