-
Notifications
You must be signed in to change notification settings - Fork 0
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
DM-46427: Handle slack interaction payloads #33
Merged
Merged
Conversation
This file contains 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
jonathansick
added a commit
to lsst-sqre/phalanx
that referenced
this pull request
Sep 23, 2024
This adds support for parsing block_actions interaction events from Slack. See lsst-sqre/squarebot#33
jonathansick
force-pushed
the
tickets/DM-46427
branch
from
September 23, 2024 17:24
f6792c3
to
df7faf9
Compare
jonathansick
added a commit
to lsst-sqre/phalanx
that referenced
this pull request
Sep 24, 2024
This adds support for parsing block_actions interaction events from Slack. See lsst-sqre/squarebot#33
jonathansick
added a commit
to lsst-sqre/templatebot
that referenced
this pull request
Sep 24, 2024
From lsst-sqre/squarebot#33 this pre-release has support for block actions payloads and kafka topic.
jonathansick
force-pushed
the
tickets/DM-46413
branch
from
September 26, 2024 17:59
068cef9
to
eee5464
Compare
This improves the model so it better captures an interaction with a static select menu in a message. Other types of interactions will need to add to subtypes to SlackBlockActionBase.
This adapts the `verify_slack` method to now handle both JSON payloads (like from the events API), and form-encoded data (like from the interactions API). This idea is based on the tip from encode/starlette#1933 (reply in thread)
It seems that static selects published with block kit message attachments actually come out as "message" container types. Include an actual interaction payload featuring this behaviour for testing. I think it should be safe to include in the test library because all triggers, IDs, and response URLs should be expired by now.
This Kafka topic and publisher is for block_actions interaction types. It replaces the original interim topic for interactions in general since we've decided to make separate Kafka topics for the different types of Kafka interactions (block actions vs views vs message shortcuts).
The value is based on the full Pydantic model for the block actions payload since we're modelling it well. It also includes the raw json body in the slack_interaction field for clients to get additional details that aren't parsed.
- Parse the view_submission interaction type into a Pydantic model (this model needs more work because it'll need to contain a copy of the view, but it'd be easy to base that model off the Block Kit models that we'll eventually put in Safir) - Add a topic configuration for view submissions - Add a publisher for view submissions, including models for the Kafka key and topic.
jonathansick
force-pushed
the
tickets/DM-46427
branch
from
September 26, 2024 22:06
fce5420
to
1d51da1
Compare
jonathansick
added a commit
to lsst-sqre/phalanx
that referenced
this pull request
Sep 26, 2024
This adds support for parsing block_actions interaction events from Slack. See lsst-sqre/squarebot#33
jonathansick
added a commit
to lsst-sqre/templatebot
that referenced
this pull request
Oct 8, 2024
From lsst-sqre/squarebot#33 this pre-release has support for block actions payloads and kafka topic.
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.
This pull request introduces significant updates to the Slack interaction handling and the Docker environment. The main changes include adding support for Slack block actions and view submissions, updating the Docker base image, and improving message verification. This is driven by the re-implementation of templatebot as a FastAPI/FastStream application, see lsst-sqre/templatebot#67.
Slack Interaction Enhancements:
New Features:
$SQUAREBOT_TOPIC_BLOCK_ACTIONS
and$SQUAREBOT_TOPIC_VIEW_SUBMISSION
).client/src/rubin/squarebot/models/kafka.py
.client/src/rubin/squarebot/models/slack.py
to include models for Slack block actions and view submissions. [1] [2]Configuration and Service Updates:
server/src/squarebot/config.py
.server/src/squarebot/factory.py
to include publishers for the new Slack interactions. [1] [2] [3]server/src/squarebot/main.py
to handle the new Kafka topics.Docker Environment Update:
python:3.12.3-slim-bullseye
topython:3.12.6-slim-bookworm
in theDockerfile
.Bug Fixes:
server/src/squarebot/services/slack.py
. [1] [2] [3] [4]