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

Fix for properly processing Slack payloads #1605

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

omid-jf
Copy link

@omid-jf omid-jf commented Mar 29, 2021

Fixes #1548

Description

Most of the changes are ports from the dotnet code. This PR is required to handle Slack actions (such as clicking on buttons) properly. Moreover, there are several type mismatches that result in many None values (for example, payload.channel is a dictionary and payload.channel.id is used instead of payload.channel.get("id")).
Note: There are some overlaps with PR #1559

Specific Changes

  1. Added SlackText class to represent a text object of Slack
  2. Added SlackAction class to represent an action block object of Slack
  3. Changed SlackPayload class to use SlackAction for actions
  4. Changed SlackEvent class to use SlackAction for actions
  5. The user ID of a received event from Slack is in event.user and not in event.user_id
  6. Populated the timestamp property of even objects from event.event_ts by converting to UTC datetime
  7. Typo and type mismatch fixes

1. Added SlackText class to represent a text object of Slack
2. Added SlackAction class to represent an action block object of Slack
3. Changed SlackPayload class to use SlackAction for actions
4. Changed SlackEvent class to use SlackAction for actions
5. The user ID of a received event from Slack is in event.user and not in event.user_id
6. Populated the timestamp property of even objects from event.event_ts by converting to UTC datetime
7. Typo and type mismatch fixes
@ghost
Copy link

ghost commented Mar 29, 2021

CLA assistant check
All CLA requirements met.

@tracyboehrer
Copy link
Member

@omid-jf Thank! I'd be glad to approve and merge this. The PR validation is failing because you need to run the black formatter on slack_helper.py.

@omid-jf
Copy link
Author

omid-jf commented Apr 7, 2021

@tracyboehrer The checks are still failing after running the black formatter on slack_helper.py
BTW, commit 1c1dc08 helps with sending Yes/No confirm prompts to Slack.

@cleemullins
Copy link
Contributor

@axelsrz Can you land this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Received Slack payloads are not processed properly
3 participants