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

Adding example event payload for interactive component #21

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 187 additions & 0 deletions docs/root/installation_and_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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": "A123456",
"name": "oktabot"
},
"callback_id": "oktabot_events",
"channel": {
"id": "C123456",
"name": "privategroup"
},
"message": {
"app_id": "A123456",
"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": "B123456",
"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": [
"T123456"
]
},
"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": "A123456",
"avatar_hash": "ecbc05b8018e",
"bot_id": "B123456",
"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": "T123456",
"title": ""
},
"real_name": "oktabot",
"team_id": "T123456",
"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
Expand Down
Loading