Skip to content

Commit a816027

Browse files
committed
Update Workflow Steps documents
1 parent 1b58dab commit a816027

File tree

4 files changed

+20
-36
lines changed

4 files changed

+20
-36
lines changed

docs/_steps/adding_editing_workflow_step.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,21 @@ def edit(ack, step, configure):
2828
"element": {
2929
"type": "plain_text_input",
3030
"action_id": "name",
31-
"placeholder": {
32-
"type": "plain_text",
33-
"text": "Add a task name",
34-
},
35-
},
36-
"label": {
37-
"type": "plain_text",
38-
"text": "Task name",
31+
"placeholder": {"type": "plain_text", "text": "Add a task name"},
3932
},
33+
"label": {"type": "plain_text", "text": "Task name"},
4034
},
4135
{
4236
"type": "input",
4337
"block_id": "task_description_input",
4438
"element": {
4539
"type": "plain_text_input",
4640
"action_id": "description",
47-
"placeholder": {
48-
"type": "plain_text",
49-
"text": "Add a task description",
50-
},
51-
},
52-
"label": {
53-
"type": "plain_text",
54-
"text": "Task description",
41+
"placeholder": {"type": "plain_text", "text": "Add a task description"},
5542
},
43+
"label": {"type": "plain_text", "text": "Task description"},
5644
},
5745
]
58-
5946
configure(blocks=blocks)
6047

6148
ws = WorkflowStep(
@@ -64,6 +51,5 @@ ws = WorkflowStep(
6451
save=save,
6552
execute=execute,
6653
)
67-
6854
app.step(ws)
6955
```

docs/_steps/creating_workflow_step.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ After instantiating a `WorkflowStep`, you can pass it into `app.step()`. Behind
1818
</div>
1919

2020
```python
21+
import os
2122
from slack_bolt import App
2223
from slack_bolt.workflows.step import WorkflowStep
2324

@@ -27,14 +28,22 @@ app = App(
2728
signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
2829
)
2930

31+
def edit(ack, step, configure):
32+
pass
33+
34+
def save(ack, view, update):
35+
pass
36+
37+
def execute(step, complete, fail):
38+
pass
39+
3040
# Create a new WorkflowStep instance
3141
ws = WorkflowStep(
3242
callback_id="add_task",
3343
edit=edit,
3444
save=save,
3545
execute=execute,
3646
)
37-
3847
# Pass Step to set up listeners
3948
app.step(ws)
4049
```

docs/_steps/executing_workflow_steps.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,17 @@ Within the `execute` callback, your app must either call `complete()` to indicat
1818
```python
1919
def execute(step, complete, fail):
2020
inputs = step["inputs"]
21-
21+
# if everything was successful
2222
outputs = {
2323
"task_name": inputs["task_name"]["value"],
2424
"task_description": inputs["task_description"]["value"],
2525
}
26+
complete(outputs=outputs)
2627

28+
# if something went wrong
2729
error = {
2830
"message": "Just testing step failure!"
2931
}
30-
31-
# if everything was successful
32-
complete(outputs=outputs)
33-
34-
# if something went wrong
3532
fail(error=error)
3633

3734
ws = WorkflowStep(
@@ -40,6 +37,5 @@ ws = WorkflowStep(
4037
save=save,
4138
execute=execute,
4239
)
43-
4440
app.step(ws)
4541
```

docs/_steps/saving_workflow_step.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,9 @@ def save(ack, view, update):
2929
task_description = values["task_description_input"]["description"]
3030

3131
inputs = {
32-
"task_name": {
33-
"value": task_name.value
34-
},
35-
"task_description": {
36-
"value": task_description.value
37-
},
32+
"task_name": {"value": task_name.value},
33+
"task_description": {"value": task_description.value}
3834
}
39-
4035
outputs = [
4136
{
4237
"type": "text",
@@ -49,15 +44,13 @@ def save(ack, view, update):
4944
"label": "Task description",
5045
}
5146
]
52-
53-
update(inputs=inputs, outputs=outputs);
47+
update(inputs=inputs, outputs=outputs)
5448

5549
ws = WorkflowStep(
5650
callback_id="add_task",
5751
edit=edit,
5852
save=save,
5953
execute=execute,
6054
)
61-
6255
app.step(ws)
6356
```

0 commit comments

Comments
 (0)