Open
Conversation
lf-
requested changes
Apr 15, 2025
Contributor
lf-
left a comment
There was a problem hiding this comment.
heya, thanks for the contribution! Can you please add that JSON as a golden test so that we can make sure it doesn't regress?
Otherwise lgtm.
Contributor
|
Actually wait a minute.... Are we sure this isn't a SlackWebhookEvent? slack-web/src/Web/Slack/Experimental/Events/Types.hs Lines 388 to 394 in a802937 The thing that's weird here is that those docs could also be read as "it's x-form-urlencoded with a I am a little bit confused as to what context you got that data in. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was parsing interactive commands from Slack sent via websocket and realized the parsing of
SlackInteractivePayloadwasn't working. The JSON it was expecting was actually all under a "payload" key. This seems to match the docs:https://api.slack.com/messaging/interactivity#understanding_payloads
Here's an example of the JSON I received:
{ "envelope_id": "4c5b7ddd-93e4-4100-bd31-469dc0da2a74", "payload": { "type": "block_actions", "user": { "id": "U6TF7D36Y", "username": "max", "name": "max", "team_id": "T6TBZABPW" }, "api_app_id": "A02JS09R199", "token": "at9L8bAfkSgMXMcCXYnEx7W4", "container": { "type": "message", "message_ts": "1744643896.565239", "channel_id": "D03HC9XKZBK", "is_ephemeral": false }, "trigger_id": "8762673254145.231407351812.1081a4547c3eef355373a7b1c4d3cc55", "team": { "id": "T6TBZABPW", "domain": "mercurytechnologies", "enterprise_id": "E088T4586SY", "enterprise_name": "Mercury" }, "enterprise": { "id": "E088T4586SY", "name": "Mercury" }, "is_enterprise_install": false, "channel": { "id": "D03HC9XKZBK", "name": "directmessage" }, "message": { "user": "U02JBAN4TMM", "type": "message", "ts": "1744643896.565239", "bot_id": "B02JS1B80JW", "app_id": "A02JS09R199", "text": "Mark Read button", "team": "T6TBZABPW", "blocks": [ { "type": "actions", "block_id": "Da20m", "elements": [ { "type": "button", "action_id": "button1", "text": { "type": "plain_text", "text": "Mark Read", "emoji": true } } ] } ] }, "state": { "values": {} }, "response_url": "https://hooks.slack.com/actions/T6TBZABPW/8762673200785/jUHi85fRbVeX5XHtgG6qyVP4", "actions": [ { "action_id": "button1", "block_id": "Da20m", "text": { "type": "plain_text", "text": "Mark Read", "emoji": true }, "type": "button", "action_ts": "1744643994.442584" } ] }, "type": "interactive", "accepts_response_payload": false }I have not actually built slack-web and confirmed this works, but I did modify my own code like so:
and that seems to have worked correctly
Before submitting your PR, check that you've:
n/a
@sincedeclarations to the Haddockn/a
After submitting your PR:
(unreleased)on the Changelog