forked from slack-samples/deno-reverse-string
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manifest.ts
89 lines (83 loc) · 2.19 KB
/
manifest.ts
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import {
DefineFunction,
DefineWorkflow,
Manifest,
Schema,
} from "deno-slack-sdk/mod.ts";
export const ReverseFunction = DefineFunction({
callback_id: "reverse",
title: "Reverse",
description: "Takes a string and reverses it",
source_file: "functions/reverse.ts",
input_parameters: {
properties: {
stringToReverse: {
type: Schema.types.string,
description: "The string to reverse",
},
},
required: ["stringToReverse"],
},
output_parameters: {
properties: {
reverseString: {
type: Schema.types.string,
description: "The string in reverse",
},
},
required: ["reverseString"],
},
});
export const TestReverseWorkflow = DefineWorkflow({
callback_id: "test_reverse",
title: "Test Reverse Function",
description: "test the reverse function",
input_parameters: {
properties: {
interactivity: {
type: Schema.slack.types.interactivity,
},
channel: {
type: Schema.slack.types.channel_id,
},
},
required: ["interactivity"],
},
});
const formData = TestReverseWorkflow.addStep(Schema.slack.functions.OpenForm, {
title: "Reverse string form",
submit_label: "Submit form",
description: "Submit a string to reverse",
interactivity: TestReverseWorkflow.inputs.interactivity,
fields: {
required: ["channel", "stringInput"],
elements: [
{
name: "stringInput",
title: "String input",
type: Schema.types.string,
},
{
name: "channel",
title: "Post in",
type: Schema.slack.types.channel_id,
default: TestReverseWorkflow.inputs.channel,
},
],
},
});
const reverseStep = TestReverseWorkflow.addStep(ReverseFunction, {
stringToReverse: formData.outputs.fields.stringInput,
});
TestReverseWorkflow.addStep(Schema.slack.functions.SendMessage, {
channel_id: formData.outputs.fields.channel,
message: reverseStep.outputs.reverseString,
});
export default Manifest({
name: "reverse",
description: "Reverse a string",
icon: "assets/default_new_app_icon.png",
workflows: [TestReverseWorkflow],
outgoingDomains: [],
botScopes: ["commands", "chat:write", "chat:write.public"],
});