abdolence / slack-morphism-rust

A modern async client library for Rust, supports Slack Web / Events API/Socket Mode and Block Kit.
https://slack-rust.abdolence.dev
Apache License 2.0
156 stars 57 forks source link

Missing event types: `block_suggestion` UrlEncoded payload POST from slack and a the required response for populating a dropdown #186

Open noxasaxon opened 1 year ago

noxasaxon commented 1 year ago

I'm working on getting a PR through, but before i forget i wanted to drop a note here for future users.

image

and heres a scrubbed example of what the URL post is from slack (when used in a View Modal). note the type is block_suggestion and its sent as a url encoded params (Form extractor in Axum):

{
    "payload": {
        "type": "block_suggestion",
        "user": {
            "id": "<user_id>",
            "username": "<name>",
            "name": "<name>",
            "team_id": "<team_id>"
        },
        "container": {
            "type": "view",
            "view_id": "<view_id>"
        },
        "api_app_id": "<api_app_id>",
        "token": "<token>",
        "action_id": "<action_id>",
        "block_id": "<block_id>",
        "value": "test",
        "team": {
            "id": "<team_id>",
            "domain": "<domain>",
            "enterprise_id": "<enterprise_id>",
            "enterprise_name": "<enterprise_name>"
        },
        "enterprise": {
            "id": "<ent_id>",
            "name": "ent_name>"
        },
        "is_enterprise_install": false,
        "view": {
            ...<view_obj>
        }
    }
}
noxasaxon commented 1 year ago

SlackInteractionEvent will need a new variant, BlockSuggestion

pub enum SlackInteractionEvent {
    #[serde(rename = "block_actions")]
    BlockActions(SlackInteractionBlockActionsEvent),
    #[serde(rename = "dialog_submission")]
    DialogSubmission(SlackInteractionDialogueSubmissionEvent),
    #[serde(rename = "message_action")]
    MessageAction(SlackInteractionMessageActionEvent),
    #[serde(rename = "shortcut")]
    Shortcut(SlackInteractionShortcutEvent),
    #[serde(rename = "view_submission")]
    ViewSubmission(SlackInteractionViewSubmissionEvent),
    #[serde(rename = "view_closed")]
    ViewClosed(SlackInteractionViewClosedEvent),
}
abdolence commented 1 year ago

Hey, great you're working on it 🏆 Thanks for detail info and the links!

Let me know if you need any help from me.

nnishimura commented 1 day ago

I noticed this issue has been stale for a while - I also needed to add this to my project's fork. I'd love to take this over 👍