-
Notifications
You must be signed in to change notification settings - Fork 29
/
slackpost.html
323 lines (292 loc) · 12.2 KB
/
slackpost.html
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<script type="text/x-red" data-template-name="slack-config">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-config-input-token"><i class="fa fa-user"></i> Token</label>
<input type="text" id="node-config-input-token" placeholder="" />
</div>
</script>
<script type="text/x-red" data-help-name="slack-config">
<p>Configuration node for Slack.</p>
<h3>Details</h3>
<p>Simply supply your Slack token. A <i>bot</i> token is likely much easier than a <i>user</i> token.</p>
<h3>References</h3>
<ul>
<li><a href="https://api.slack.com/docs/token-types">Token Types</a> - explanation of Slack token types</li>
<li><a href="https://api.slack.com/tokens">Tokens</a> - list of Slack tokens you already have</li>
<li><a href="https://api.slack.com">Slack API Introduction</a> - introduction to Slack APIs</li>
<li><a href="https://api.slack.com/rtm">Slack RTM API</a> - full description of RTM API</li>
<li><a href="https://api.slack.com/web">Slack Web API</a> - full description of Web API</li>
<li><a href="https://api.slack.com/methods">Slack Web API Methods</a> - full descriptions of all Web API methods</li>
<li><a href="https://github.com/yayadrian/node-red-slack">GitHub</a> - project homepage</li>
</ul>
</script>
<script type="text/x-red" data-template-name="slack-state">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-client"><i class="fa fa-user"></i> Slack Client</label>
<input type="text" id="node-input-client">
</div>
</script>
<script type="text/x-red" data-help-name="slack-state">
<p>Outputs and <i>optionally</i> refreshes the <code>msg.slackState</code> data.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt class="optional">payload
<span class="property-type">boolean</span>
</dt>
<dd>If <code>true</code> then <code>msg.slackState</code> will be refreshed before output.</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>State
<dl class="message-properties">
<dt>slackState <span class="property-type">object</span></dt>
<dd>The current state of the slack connection.</dd>
</dl>
<li>Events
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>The state event details.</dd>
<dt>slackState <span class="property-type">object</span></dt>
<dd>The current state of the slack connection.</dd>
</dl>
</li>
</ol>
<h3>References</h3>
<ul>
<li><a href="https://github.com/yayadrian/node-red-slack#slack-state">slack-state</a> - full description of node behavior</li>
<li><a href="https://github.com/yayadrian/node-red-slack#slackstate">slackState</a> - full description of <code>msg.slackState</code> object</li>
<li><a href="https://api.slack.com">Slack API Introduction</a> - introduction to Slack APIs</li>
<li><a href="https://api.slack.com/rtm">Slack RTM API</a> - full description of RTM API</li>
<li><a href="https://api.slack.com/web">Slack Web API</a> - full description of Web API</li>
<li><a href="https://api.slack.com/methods">Slack Web API Methods</a> - full descriptions of all Web API methods</li>
<li><a href="https://github.com/yayadrian/node-red-slack">GitHub</a> - project homepage</li>
</ul>
</script>
<script type="text/x-red" data-template-name="slack-rtm-in">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-client"><i class="fa fa-user"></i> Slack Client</label>
<input type="text" id="node-input-client">
</div>
<div class="form-row">
<label for="node-input-events"><i class="fa fa-filter"></i> Slack Events</label>
<input type="text" id="node-input-events" placeholder="message">
</div>
<div class="form-tips"><b>Tip:</b> Leave blank to receive <b>ALL</b> events.</div>
</script>
<script type="text/x-red" data-help-name="slack-rtm-in">
<p>Listens to Slack RTM API events and outputs the event details.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>The Slack RTM API event.</dd>
<dt>slackState <span class="property-type">object</span></dt>
<dd>The current state of the slack connection.</dd>
</dl>
<h3>Details</h3>
<p>
For a complete list of events emitted with their details review the <a href="https://api.slack.com/rtm">Slack RTM API</a> documentation.
</p>
<p>
By default the node will listen to <b>ALL</b> events (<code>slack_event</code>). You can however filter event types by setting the node <em>Slack Events</em> property
to a value taking the form of <code>type[::subtype][,type[::subtype],...]</code>. For example <code>message</code> to receive only events of type <code>message</code>
or <code>message::bot_message</code> to receive only events of type <code>message</code> which additionally have a <code>subtype</code> of <code>bot_message</code>.
</p>
<h3>References</h3>
<ul>
<li><a href="https://github.com/yayadrian/node-red-slack#slack-rtm-in">slack-rtm-in</a> - full description of node behavior</li>
<li><a href="https://api.slack.com">Slack API Introduction</a> - introduction to Slack APIs</li>
<li><a href="https://api.slack.com/rtm">Slack RTM API</a> - full description of RTM API</li>
<li><a href="https://github.com/yayadrian/node-red-slack#slackstate">slackState</a> - full description of <code>msg.slackState</code> object</li>
<li><a href="https://github.com/yayadrian/node-red-slack">GitHub</a> - project homepage</li>
</ul>
</script>
<script type="text/x-red" data-template-name="slack-rtm-out">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-client"><i class="fa fa-user"></i> Slack Client</label>
<input type="text" id="node-input-client">
</div>
</script>
<script type="text/x-red" data-help-name="slack-rtm-out">
<p>Invokes a Slack RTM API method and outputs the response.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>topic
<span class="property-type">string</span>
</dt>
<dd>The method name.</dd>
<dt class="optional">payload
<span class="property-type">object</span>
</dt>
<dd>The method arguments.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>The Slack RTM API response.</dd>
<dt>slackState <span class="property-type">object</span></dt>
<dd>The current state of the slack connection.</dd>
</dl>
<h3>Details</h3>
<p>
For simple message sending as an alternative the to method/arguments style, you may set the <code>msg.topic</code> to either <code>@username</code> or <code>#channel</code> syntax.
If you use this syntax simply set <code>msg.payload</code> to the message you want sent.
</p>
<h3>References</h3>
<ul>
<li><a href="https://github.com/yayadrian/node-red-slack#slack-rtm-out">slack-rtm-out</a> - full description of node behavior</li>
<li><a href="https://api.slack.com">Slack API Introduction</a> - introduction to Slack APIs</li>
<li><a href="https://api.slack.com/rtm">Slack RTM API</a> - full description of RTM API</li>
<li><a href="https://github.com/yayadrian/node-red-slack#slackstate">slackState</a> - full description of <code>msg.slackState</code> object</li>
<li><a href="https://github.com/yayadrian/node-red-slack">GitHub</a> - project homepage</li>
</ul>
</script>
<script type="text/x-red" data-template-name="slack-web-out">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-client"><i class="fa fa-user"></i> Slack Client</label>
<input type="text" id="node-input-client">
</div>
</script>
<script type="text/x-red" data-help-name="slack-web-out">
<p>Invokes a Slack Web API method and outputs the response.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>topic
<span class="property-type">string</span>
</dt>
<dd>The method name.</dd>
<dt class="optional">payload
<span class="property-type">object</span>
</dt>
<dd>The method arguments.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>The Slack Web API response.</dd>
<dt>slackState <span class="property-type">object</span></dt>
<dd>The current state of the slack connection.</dd>
</dl>
<h3>Details</h3>
<p>
For simple message sending as an alternative the to method/arguments style, you may set the <code>msg.topic</code> to either <code>@username</code> or <code>#channel</code> syntax.
If you use this syntax simply set <code>msg.payload</code> to the message you want sent.
</p>
<h3>References</h3>
<ul>
<li><a href="https://github.com/yayadrian/node-red-slack#slack-web-out">slack-web-out</a> - full description of node behavior</li>
<li><a href="https://api.slack.com">Slack API Introduction</a> - introduction to Slack APIs</li>
<li><a href="https://api.slack.com/web">Slack Web API</a> - full description of Web API</li>
<li><a href="https://api.slack.com/methods">Slack Web API Methods</a> - full descriptions of all Web API methods</li>
<li><a href="https://github.com/yayadrian/node-red-slack#slackstate">slackState</a> - full description of <code>msg.slackState</code> object</li>
<li><a href="https://github.com/yayadrian/node-red-slack">GitHub</a> - project homepage</li>
</ul>
</script>
<script type="text/javascript">
/**
* slack purple #611f69
* lightened up because on the canvas the default is very dark
*/
RED.nodes.registerType("slack-config", {
category: "config",
defaults: {
name: { value: "" }
},
credentials: {
token: { type: "text" }
},
label: function() {
return this.name || "slack-config";
}
});
RED.nodes.registerType("slack-state", {
category: "social",
defaults: {
client: { type: "slack-config", required: true },
name: { value: "" }
},
color: "#C785CF",
icon: "slack_mark_white.png",
align: "left",
inputs: 1,
inputLabels: "state request",
outputs: 2,
outputLabels: ["state", "state events"],
label: function() {
return this.name || "slack-state";
},
paletteLabel: "slack-state"
});
RED.nodes.registerType("slack-rtm-in", {
category: "social",
defaults: {
client: { type: "slack-config", required: true },
name: { value: "" },
events: { value: "" }
},
color: "#C785CF",
icon: "slack_mark_white.png",
align: "left",
inputs: 0,
outputs: 1,
outputLabels: ["rtm events"],
label: function() {
return this.name || "slack-rtm-in";
},
paletteLabel: "slack-rtm-in"
});
RED.nodes.registerType("slack-rtm-out", {
category: "social",
defaults: {
client: { type: "slack-config", required: true },
name: { value: "" }
},
color: "#C785CF",
icon: "slack_mark_white.png",
align: "left",
inputs: 1,
inputLabels: "rtm request",
outputs: 1,
outputLabels: ["rtm response"],
label: function() {
return this.name || "slack-rtm-out";
},
paletteLabel: "slack-rtm-out"
});
RED.nodes.registerType("slack-web-out", {
category: "social",
defaults: {
client: { type: "slack-config", required: true },
name: { value: "" }
},
color: "#C785CF",
icon: "slack_mark_white.png",
align: "left",
inputs: 1,
inputLabels: "web request",
outputs: 1,
outputLabels: ["web response"],
label: function() {
return this.name || "slack-web-out";
},
paletteLabel: "slack-web-out"
});
</script>