X Tutup
Skip to content

Commit 79d80b0

Browse files
misscodedseratch
authored andcommitted
minor text change + remove dialog submission ref/example
1 parent 2519e4e commit 79d80b0

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

docs/_basic/acknowledging_events.md

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,25 @@ order: 7
99

1010
Actions, commands, and options events must **always** be acknowledged using the `ack()` function. This lets Slack know that the event was received and updates the Slack user interface accordingly.
1111

12-
Depending on the type of event, your acknowledgement may be different. For example, when acknowledging a dialog submission you will call `ack()` with validation errors if the submission contains errors, or with no parameters if the submission is valid.
12+
Depending on the type of event, your acknowledgement may be different. For example, when acknowledging a menu selection associated with an external data source, you would call `ack()` with a list of relevant [options](https://api.slack.com/reference/block-kit/composition-objects#option).
1313

1414
We recommend calling `ack()` right away before sending a new message or fetching information from your database since you only have 3 seconds to respond.
1515

1616
</div>
1717

1818
```python
19-
import re
20-
21-
# Listen for dialog submissions with a callback_id of ticket_submit
22-
@app.action("ticket_submit")
23-
def process_submission(ack, action):
24-
# Regex to determine if this is a valid email
25-
is_email = "^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$"
26-
27-
if re.match(is_email, action["submission"]["email"]):
28-
# It’s a valid email, accept the submission
29-
ack()
30-
else:
31-
# If it isn’t a valid email, acknowledge with an error
32-
errors = [{
33-
"name": "email_address",
34-
"error": "Sorry, this isn’t a valid email"
35-
}]
36-
ack(errors=errors)
19+
# Example of responding to an external_select options request
20+
@app.options("menu_selection")
21+
def show_menu_options(ack):
22+
options = [
23+
{
24+
"text": {"type": "plain_text", "text": "Option 1"},
25+
"value": "1-1",
26+
},
27+
{
28+
"text": {"type": "plain_text", "text": "Option 2"},
29+
"value": "1-2",
30+
},
31+
]
32+
ack(options=options)
3733
```

docs/_basic/responding_actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ order: 6
77

88
<div class="section-content">
99

10-
There are two main ways to respond to actions. The first (and most common) way is to use the `say` function. The `say` function sends a message back to the conversation where the incoming event took place.
10+
There are two main ways to respond to actions. The first (and most common) way is to use `say()`, which sends a message back to the conversation where the incoming event took place.
1111

1212
The second way to respond to actions is using `respond()`, which is a utility to use the `response_url` associated with the action.
1313

0 commit comments

Comments
 (0)
X Tutup