-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrigger.java
More file actions
41 lines (38 loc) · 2.24 KB
/
Copy pathTrigger.java
File metadata and controls
41 lines (38 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package compositionobjects;
import static com.slack.api.model.block.composition.BlockCompositions.markdownText;
import static com.slack.api.model.block.composition.BlockCompositions.plainText;
import com.slack.api.model.block.Blocks;
import com.slack.api.model.block.SectionBlock;
import com.slack.api.model.block.composition.WorkflowObject;
import com.slack.api.model.block.element.BlockElements;
import java.util.List;
/**
* Defines an object containing trigger information.
* {@link https://docs.slack.dev/reference/block-kit/composition-objects/trigger-object/}
*/
public class Trigger {
/**
* A section block with a workflow button whose trigger carries customizable input parameters.
*/
public static SectionBlock example01() {
SectionBlock block =
Blocks.section(s -> s.text(markdownText("A message *with some bold text* and _some italicized text_."))
.accessory(BlockElements.workflowButton(w -> w.text(plainText("Run Workflow"))
.actionId("workflowbutton123")
.workflow(WorkflowObject.builder()
.trigger(WorkflowObject.Trigger.builder()
.url("https://slack.com/shortcuts/Ft0123ABC456/xyz...zyx")
.customizableInputParameters(List.of(
WorkflowObject.Trigger.InputParameter.builder()
.name("input_parameter_a")
.value("Value for input param A")
.build(),
WorkflowObject.Trigger.InputParameter.builder()
.name("input_parameter_b")
.value("Value for input param B")
.build()))
.build())
.build()))));
return block;
}
}