-
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
Adding Message Metadata Support to Bolt JS #1508
Adding Message Metadata Support to Bolt JS #1508
Conversation
Regarding Issue #1507 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically looks great to me but I have one additional change request 🙇
bot_id?: string; | ||
user_id: string; | ||
team_id: string; | ||
message_ts: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add deleted_ts: string
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another good catch, this is done 👍
As the CI build failure shows, this pull request requires a new version release of |
I'm assuming we would wait for this milestone before consider merging this PR, right? |
@dannyhostetler Thanks for checking the milestone. Since other tasks that were listed there need more time, I've moved them to other milestones. We will release a new package version shortly. |
types v2.6.0 is now available https://github.com/slackapi/node-slack-sdk/releases/tag/%40slack%2Ftypes%402.6.0 |
Can you fix the test failure detected by GitHub Actions jobs?
|
Codecov Report
@@ Coverage Diff @@
## main #1508 +/- ##
==========================================
+ Coverage 82.00% 82.07% +0.06%
==========================================
Files 18 18
Lines 1495 1495
Branches 435 435
==========================================
+ Hits 1226 1227 +1
Misses 172 172
+ Partials 97 96 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, this looks good to me!
I did have one question and one suggestion.
Suggestion: what about adding a very simple example to the examples/
directory that includes showing an app listening to metadata events as well as using these types? I think that would be helpful to a lot of people, as well as for us the maintainers, whom have to quickly reproduce different scenarios for how people build apps. I always use the examples a lot to help with triaging new incoming issues.
Question: do we need to take these metadata events into account in the event / middleware processing chain in bolt? In particular, the conversation ID extraction logic. This method has different logic to pull out the conversation ID based on the kind of event being received. Do we need to add some more logic to take into account the message metadata event structure here?
Thanks a lot for taking the time to send these pull requests, it is very much appreciated 🙏
No, I don't think so. The conversation ID is supposed to be used only by https://slack.dev/bolt-js/concepts#conversation-store and the convo store feature is associated with message-type events. If a developer intentionally use metadata events only, I am sure that the developer does not expect convo store to work with convo store well. Also, in reality, I think that the convo store is not used a lot. The feature was added to provide an alternative for hubot's brain: https://slack.dev/bolt-js/tutorial/hubot-migration#migrating-the-brain-to-the-conversation-store There is no downside to keep the feature so far but, in future major versions, we may consider deprecating the feature or removing the feature from the core module. |
Fantastic suggestion, and thanks for the feedback! Agreed, I myself am always referring to these examples. I'm working on mocking up a simple example RE: Message Metadata events and I'll get it pushed within the next day or so. |
Ah, thanks for educating me on that @seratch ! |
examples/message-metadata/app.js
Outdated
|
||
app.event('message_metadata_posted', async ({ event, say }) => { | ||
const { message_ts: thread_ts } = event; | ||
say({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
say({ | |
await say({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake, thanks for catching. This is fixed.
examples/message-metadata/app.js
Outdated
// Post a message with Message Metadata | ||
app.command('/post', async ({ ack, command, say }) => { | ||
await ack(); | ||
say({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
say({ | |
await say({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake, thanks for catching. This is fixed.
Hey @dannyhostetler ! One thing I noticed trying to get the example running by linking up the bolt-js root repo first is I get this error:
I think that's because Odd that the CI didn't pick this up... I guess because the semver specifier for |
@filmaj Think this should be good now. For what ever reason I explicitly removed that from the package.json because @slack\types is a dependency package of bolt and didn't think it was needed. Anywho, give it a try again and see if this works for you. |
@dannyhostetler Oh, I meant in the top-level |
Oh ok, gotcha. Bumped to ^2.7.0. Thanks for keeping me inline on this one 🤝 |
OK, got the package building! However, I can't seem to trigger the I'll try to dig in more tomorrow to see what's going on. |
@filmaj I'm willing to bet it's because you're missing
|
You would have won that bet @dannyhostetler ! Last request for this PR: can we add a basic |
@filmaj Yeah, the metadata subscription is a bit tricky (and I don't personally like how you have to specify the app id, I think should it be able to dynamically determine 🤷). No biggie on the README, I should have actually added one earlier (probably just being lazy). I'm traveling over the next day or so, so I'll get this pushed sometime this week. |
Yes I agree with you re: entering the App ID, seems like us-at-Slack should be able to infer that 🤨 I'll raise that internally to see if that can be improved. And thank you for following up on all my requests 🙏 really appreciate your collaboration on this 🙇 |
@filmaj Actually just went ahead and did this now. Added a basic README, hope this looks good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!!! 🎉 Thanks a lot, looks great, dropping an approval here, as soon as the CI passes will merge.
Summary
The PR introduces support for Message Metadata events within the Bolt framework. This should be paired together with slackapi/node-slack-sdk#1504 as the "MessageMetadata" is defined within.
Support for MessageMetadataPostedEvent, MessageMetadataUpdated and MessageMetadataDeletedEvent are introduced within this PR.
Requirements (place an
x
in each[ ]
)