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

add interaction api #7

Merged
merged 6 commits into from
Oct 15, 2024
Merged

add interaction api #7

merged 6 commits into from
Oct 15, 2024

Conversation

koonwen
Copy link
Contributor

@koonwen koonwen commented Oct 7, 2024

add handling of interaction events, aka (shortcuts).

Slack has a different set of webhooks that fire on specific actions such as slash commands and shortcuts. This PR introduces some of the base infrastructure to receive these type of events

@koonwen koonwen marked this pull request as ready for review October 10, 2024 07:59
lib/utils.ml Outdated Show resolved Hide resolved
lib/utils.ml Outdated
for handling features such as block actions, shortcuts and modals
*)
let process_slack_interaction (ctx : Context.t) headers body ~interaction_handler =
let payload = Uri.query_of_encoded body |> List.assoc "payload" |> List.hd in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List.hd is a code smell. It's better to use a match and fail with a clear message if the list is empty. It also becomes self documented this way

Copy link
Collaborator

@Khady Khady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@Khady Khady merged commit 94fddf7 into ahrefs:master Oct 15, 2024
0 of 5 checks passed
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.

2 participants