From b597bcd28893df136b49fab96b804a976f78e4f5 Mon Sep 17 00:00:00 2001 From: ryand0 <152650863+ryand0@users.noreply.github.com> Date: Wed, 6 Mar 2024 13:49:32 -0800 Subject: [PATCH 1/2] Update installation_and_usage.rst Adding an event payload example --- docs/root/installation_and_usage.rst | 187 +++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) diff --git a/docs/root/installation_and_usage.rst b/docs/root/installation_and_usage.rst index 1ba2b50..9051364 100644 --- a/docs/root/installation_and_usage.rst +++ b/docs/root/installation_and_usage.rst @@ -64,6 +64,193 @@ Here's a really basic example, that'll route message events, and interactive com The above example will respond with ``pong``, when a user sends ``@pingbot ping``, or when an user interacts with an interactive component, which sends the ``ping_callback`` event. +Here is an example of an event payload for an interactive event (in this case, the "Continue Cleanup" button was clicked): + +.. code-block:: json + + "event": { + "actions": [ + { + "action_id": "continue_cleanup", + "action_ts": "1709149728.078244", + "block_id": "oktabot_events", + "style": "primary", + "text": { + "emoji": true, + "text": "Continue Cleanup", + "type": "plain_text" + }, + "type": "button" + } + ], + "bot": { + "bot_id": "AV3KU59U1", + "name": "oktabot" + }, + "callback_id": "oktabot_events", + "channel": { + "id": "C06E50DBT45", + "name": "privategroup" + }, + "message": { + "app_id": "AV3KU59U1", + "blocks": [ + { + "block_id": "ZocFS", + "text": { + "emoji": true, + "text": ":oktacircle: Okta Cleanup :clean:", + "type": "plain_text" + }, + "type": "header" + }, + { + "block_id": "eFD0m", + "fields": [ + { + "text": "*Inactive Users:*\n22", + "type": "mrkdwn", + "verbatim": false + }, + { + "text": "*Suspended Users:*\n5", + "type": "mrkdwn", + "verbatim": false + }, + { + "text": "*Service Accounts:*\n59", + "type": "mrkdwn", + "verbatim": false + }, + { + "text": "*Groups with no Apps:*\n48", + "type": "mrkdwn", + "verbatim": false + }, + { + "text": "*Groups with no Users:*\n15", + "type": "mrkdwn", + "verbatim": false + }, + { + "text": "*Inactive Apps:*\n18", + "type": "mrkdwn", + "verbatim": false + }, + { + "text": "*Apps with No Users:*\n2", + "type": "mrkdwn", + "verbatim": false + }, + { + "text": "*Apps with No Usage:*\n1", + "type": "mrkdwn", + "verbatim": false + } + ], + "type": "section" + }, + { + "block_id": "oktabot_events", + "elements": [ + { + "action_id": "continue_cleanup", + "style": "primary", + "text": { + "emoji": true, + "text": "Continue Cleanup", + "type": "plain_text" + }, + "type": "button" + }, + { + "action_id": "cancel_cleanup", + "style": "danger", + "text": { + "emoji": true, + "text": "Cancel Cleanup", + "type": "plain_text" + }, + "type": "button" + } + ], + "type": "actions" + } + ], + "bot_id": "B0101J806MD", + "channels": [], + "emails": [], + "emojis": { + ":clean:": "clean", + ":oktacircle:": "oktacircle" + }, + "parsed_text": ":oktacircle: Okta Cleanup :clean: *Inactive Users:*\n22 *Suspended Users:*\n5 *Service Accounts:*\n59 *Groups with no Apps:*\n48 *Groups with no Users:*\n15 *Inactive Apps:*\n18 *Apps with No Users:*\n2 *Apps with No Usage:*\n1 Continue Cleanup button Cancel Cleanup button", + "parsed_user": { + "color": "2b6836", + "deleted": false, + "enterprise_user": { + "enterprise_id": "11111111", + "enterprise_name": "Lyft Org", + "id": "12345678", + "is_admin": false, + "is_owner": false, + "is_primary_owner": false, + "teams": [ + "87654321" + ] + }, + "id": "11111111", + "is_admin": false, + "is_app_user": false, + "is_bot": true, + "is_email_confirmed": false, + "is_owner": false, + "is_primary_owner": false, + "is_restricted": false, + "is_ultra_restricted": false, + "name": "oktabot", + "profile": { + "always_active": true, + "api_app_id": "AV3KU59U1", + "avatar_hash": "ecbc05b8018e", + "bot_id": "BV0UGFQ02", + "display_name": "", + "display_name_normalized": "", + "first_name": "oktabot", + "image_1024": "https://avatars.slack-edge.com/2020-04-10/1054481108146_ecbc05b8018e1f0a8d74_1024.jpg", + "image_192": "https://avatars.slack-edge.com/2020-04-10/1054481108146_ecbc05b8018e1f0a8d74_192.jpg", + "image_24": "https://avatars.slack-edge.com/2020-04-10/1054481108146_ecbc05b8018e1f0a8d74_24.jpg", + "image_32": "https://avatars.slack-edge.com/2020-04-10/1054481108146_ecbc05b8018e1f0a8d74_32.jpg", + "image_48": "https://avatars.slack-edge.com/2020-04-10/1054481108146_ecbc05b8018e1f0a8d74_48.jpg", + "image_512": "https://avatars.slack-edge.com/2020-04-10/1054481108146_ecbc05b8018e1f0a8d74_512.jpg", + "image_72": "https://avatars.slack-edge.com/2020-04-10/1054481108146_ecbc05b8018e1f0a8d74_72.jpg", + "image_original": "https://avatars.slack-edge.com/2020-04-10/1054481108146_ecbc05b8018e1f0a8d74_original.jpg", + "is_custom_image": true, + "last_name": "", + "phone": "", + "real_name": "oktabot", + "real_name_normalized": "oktabot", + "skype": "", + "status_emoji": "", + "status_emoji_display_info": [], + "status_expiration": 0, + "status_text": "", + "status_text_canonical": "", + "team": "T029A67TC", + "title": "" + }, + "real_name": "oktabot", + "team_id": "T029A67TC", + "tz": "America/Los_Angeles", + "tz_label": "Pacific Standard Time", + "tz_offset": -28800, + "updated": 1621408361, + "who_can_share_contact_card": "EVERYONE" + } + } + } + + See :mod:`omnibot_receiver.router` module documentation for more detailed OmnibotRouter usage. Responding From 7f512ca36b3c13728f893d2770c62bde9f54f5dc Mon Sep 17 00:00:00 2001 From: ryand0 <152650863+ryand0@users.noreply.github.com> Date: Wed, 6 Mar 2024 22:03:46 +0000 Subject: [PATCH 2/2] Address comments --- docs/root/installation_and_usage.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/root/installation_and_usage.rst b/docs/root/installation_and_usage.rst index 9051364..1d0d93b 100644 --- a/docs/root/installation_and_usage.rst +++ b/docs/root/installation_and_usage.rst @@ -84,16 +84,16 @@ Here is an example of an event payload for an interactive event (in this case, t } ], "bot": { - "bot_id": "AV3KU59U1", + "bot_id": "A123456", "name": "oktabot" }, "callback_id": "oktabot_events", "channel": { - "id": "C06E50DBT45", + "id": "C123456", "name": "privategroup" }, "message": { - "app_id": "AV3KU59U1", + "app_id": "A123456", "blocks": [ { "block_id": "ZocFS", @@ -177,7 +177,7 @@ Here is an example of an event payload for an interactive event (in this case, t "type": "actions" } ], - "bot_id": "B0101J806MD", + "bot_id": "B123456", "channels": [], "emails": [], "emojis": { @@ -196,7 +196,7 @@ Here is an example of an event payload for an interactive event (in this case, t "is_owner": false, "is_primary_owner": false, "teams": [ - "87654321" + "T123456" ] }, "id": "11111111", @@ -211,9 +211,9 @@ Here is an example of an event payload for an interactive event (in this case, t "name": "oktabot", "profile": { "always_active": true, - "api_app_id": "AV3KU59U1", + "api_app_id": "A123456", "avatar_hash": "ecbc05b8018e", - "bot_id": "BV0UGFQ02", + "bot_id": "B123456", "display_name": "", "display_name_normalized": "", "first_name": "oktabot", @@ -236,11 +236,11 @@ Here is an example of an event payload for an interactive event (in this case, t "status_expiration": 0, "status_text": "", "status_text_canonical": "", - "team": "T029A67TC", + "team": "T123456", "title": "" }, "real_name": "oktabot", - "team_id": "T029A67TC", + "team_id": "T123456", "tz": "America/Los_Angeles", "tz_label": "Pacific Standard Time", "tz_offset": -28800,