-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmicroservice.yml
188 lines (181 loc) · 4.81 KB
/
microservice.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
omg: 1
info:
version: 0.2.0
title: Slack Microservice
description: This is a microservice for Slack
lifecycle:
startup:
command: ["python", "app/main.py"]
actions:
send:
help: |
Sends a message to a channel.
https://api.slack.com/methods/chat.postMessage
arguments:
text:
type: string
in: requestBody
required: true
help: Text of the message to send.
channel:
type: string
in: requestBody
required: true
help: |
What channel to send message in.
This can be a "#channel" "@user" or a channel id.
attachments:
type: list
in: requestBody
token: &token
in: requestBody
type: string
help: |
Authentication token bearing required scopes.
Environment variable BOT_TOKEN used by default.
output:
contentType: application/json
type: map
http: &http
path: /api/chat.postMessage
method: post
port: 8000
contentType: application/json
bot:
help: Start a Slack bot
events:
hears:
help: Triggered anytime a messages matches the pattern
arguments:
pattern:
type: string
in: requestBody
help: A regexp pattern to filter messages
channel:
type: string
in: requestBody
required: true
help: Only listen in a specific channel
http: &pubsub
port: 8000
subscribe:
method: post
path: /subscribe
contentType: application/json
unsubscribe:
path: /unsubscribe
method: post
contentType: application/json
output: &output
contentType: application/json
type: object
properties:
text:
help: The message text
type: string
client_msg_id:
help: The message ID
type: string
channel:
help: The channel ID
type: string
user:
help: The user ID
type: string
ts:
help: |
The message timestamp (eg: "1535474523.000100")
type: string
responds:
help: Triggered by direct messages to the bot
http:
<<: *pubsub
arguments:
pattern:
type: string
in: requestBody
help: A regexp pattern to filter messages
output:
<<: *output
users:
http:
<<: *http
path: /api/users.list
arguments:
token:
<<: *token
include_locale:
help: |
Set this to true to receive the locale for users. Defaults to false
type: boolean
in: requestBody
limit:
in: requestBody
type: int
default: 0
help: |
The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached.
range:
min: 0
cursor:
in: requestBody
type: string
help: |
Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.
output:
# TODO add action:next, property:has_more
contentType: application/json
type: map
channels:
help: Get a list of channels
http:
<<: *http
path: /api/channels.list
arguments:
token:
<<: *token
limit: &limit
type: int
default: 100
in: requestBody
help: Limit the number of channels to return. Must be less than 1000.
exclude_archived:
type: boolean
default: false
in: requestBody
help: Set to true to exclude archived channels from the list
types:
type: list
in: requestBody
help: |
Mix and match channel types: public_channel, private_channel, mpim, im
Default is public_channel only.
output:
contentType: application/json
type: map
# items:
# type: object
# properties:
# id:
# help: The channel ID
# type: string
# name:
# help: The channel name
# type: string
directChannels:
help: Lists direct message channels for the calling user.
http:
<<: *http
path: /api/im.list
arguments:
token:
<<: *token
limit:
<<: *limit
output:
contentType: application/json
type: map
environment:
BOT_TOKEN:
type: string
help: The Slack bot token