microsoft_teams_incoming_webhook_ruby 0.1.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.github/workflows/publish_to_rubygems.yml +0 -1
- data/.gitignore +3 -1
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +7 -1
- data/LICENSE.txt +1 -1
- data/README.md +406 -61
- data/lib/microsoft_teams_incoming_webhook_ruby/message.rb +5 -3
- data/lib/microsoft_teams_incoming_webhook_ruby/version.rb +1 -1
- data/microsoft_teams_incoming_webhook_ruby.gemspec +5 -9
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d6a6f3195a55056f01df70e9d34e8e5eb8295362ed9ec16f34a96b26491cbf1
|
4
|
+
data.tar.gz: 409e243fd39a19b1312892492885554da8a30762f31735f1162e0c48fe55f732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f3223dc3cd9a7a459bd534fa609b63d3d9657da71fa8e6f4e114133977eea92618a24e885d234f57eec308b19ccfb90dfb74d420a118c0b93d105a773acca29
|
7
|
+
data.tar.gz: ff7ab10962d645c9d223934b3f1529600ebf75bb72510b260be8698dce3cdff0f858c2cdeb2e7217da3cd3f732019cc79aabacb897aafb06251008699f54726f
|
data/.github/workflows/ci.yml
CHANGED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -37,105 +37,453 @@ gem install microsoft_teams_incoming_webhook_ruby
|
|
37
37
|
|
38
38
|
### Configuration of Incoming Webhook connector on your Teams channels
|
39
39
|
|
40
|
-
The first step before using this gem is to configure the connector inside your
|
40
|
+
The first step before using this gem is to configure the connector inside your Teams channels.
|
41
41
|
|
42
42
|
For this purpose, please check the official documentation from Microsoft. It's listed below some useful links:
|
43
43
|
|
44
|
-
- https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook
|
44
|
+
- https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook
|
45
|
+
- https://techcommunity.microsoft.com/t5/microsoft-365-pnp-blog/how-to-configure-and-use-incoming-webhooks-in-microsoft-teams/ba-p/2051118
|
45
46
|
- https://www.youtube.com/watch?v=amvh4rzTCS0
|
46
47
|
|
47
|
-
|
48
|
+
After the configuration, keep your generated Incoming Webhook URL in a secret and secure way.
|
48
49
|
|
49
|
-
|
50
|
+
You will use it (the URL) in next sections of README.
|
51
|
+
|
52
|
+
### Hello World message sending
|
53
|
+
|
54
|
+
Once you have configured Incoming Webhook inside your Teams channels, you can send a very simple `Hello World` message:
|
50
55
|
|
51
56
|
```ruby
|
52
57
|
require 'microsoft_teams_incoming_webhook_ruby'
|
53
58
|
|
54
59
|
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
55
|
-
m.url
|
60
|
+
m.url = 'YOUR INCOMING WEBHOOK URL HERE'
|
56
61
|
m.text = 'Hello World!'
|
57
62
|
end
|
58
63
|
|
59
64
|
message.send
|
60
65
|
```
|
61
66
|
|
62
|
-
Note that there are 2 keys that is the minimum required to define a valid message:
|
67
|
+
Note that there are 2 keys that is the minimum required to define a valid message for Teams:
|
63
68
|
- `url`: The URL of Incoming Webhook connector, generated via Microsoft Teams
|
64
69
|
- `text`: The text of your message
|
65
70
|
|
66
|
-
There are many other possible keys to be sent to Microsoft Incoming Webhook API.
|
71
|
+
There are many other possible keys to be sent to Microsoft Incoming Webhook API.
|
72
|
+
But pay attention to always send **at least** the 2 keys.
|
67
73
|
|
68
|
-
###
|
74
|
+
### Gem public interface
|
69
75
|
|
70
|
-
|
76
|
+
The `MicrosoftTeamsIncomingWebhookRuby::Message` class has 3 main methods:
|
77
|
+
|
78
|
+
- `new`: Initialization of object. You need to pass a block as parameter, containing the message structure. This structure will be converted automatically to JSON and be sent to Microsoft Incoming Webhook API.
|
79
|
+
- `builder`: Message builder object, that allows add/redefine/remove fields arbitrarily.
|
80
|
+
- `send`: Invocation of Incoming Webhook API, using HTTPS.
|
81
|
+
|
82
|
+
### Message structure
|
83
|
+
|
84
|
+
The Microsoft Incoming Webhook API allows us to send a variety of fields, that will result in diferents cards displayed in Teams channels.
|
85
|
+
|
86
|
+
Because of this, the gem will not enforce any schema in message structure. The only required parameters are `url` and `text`. Any other options will be accepted, considering that Microsoft Incoming Webhook API accepts it.
|
87
|
+
|
88
|
+
The message structure and its fields can be defined in two moments:
|
89
|
+
|
90
|
+
- Initialization of `MicrosoftTeamsIncomingWebhookRuby::Message` object
|
91
|
+
- After object initialization, but before `send` method call
|
92
|
+
|
93
|
+
🚨 You can add/replace/remove any fields arbitrarily, but keeping at least the minimum required fields (`url` and `text`). Otherwise, an error will be generated when invoke `send` method.
|
94
|
+
|
95
|
+
Below there are some examples of this manipulation:
|
96
|
+
|
97
|
+
- Initialization of attributes in `MicrosoftTeamsIncomingWebhookRuby::Message` object
|
71
98
|
|
72
|
-
You can build the message with any supported [card fields](https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#card-fields).
|
73
|
-
This example is taken directly from [Microsoft Docs](https://docs.microsoft.com/en-us/outlook/actionable-messages/send-via-connectors)
|
74
99
|
```ruby
|
75
|
-
require
|
100
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
76
101
|
|
77
|
-
message =
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
m.potentialAction = [
|
83
|
-
{
|
84
|
-
"@type": "ActionCard",
|
85
|
-
"name": "Send Feedback",
|
86
|
-
"inputs": [{
|
87
|
-
"@type": "TextInput",
|
88
|
-
"id": "feedback",
|
89
|
-
"isMultiline": true,
|
90
|
-
"title": "Let us know what you think about Actionable Messages"
|
91
|
-
}],
|
92
|
-
"actions": [{
|
93
|
-
"@type": "HttpPOST",
|
94
|
-
"name": "Send Feedback",
|
95
|
-
"isPrimary": true,
|
96
|
-
"target": "http://..."
|
97
|
-
}]
|
98
|
-
},
|
99
|
-
{
|
100
|
-
"@type": "OpenUri",
|
101
|
-
"name": "Learn More",
|
102
|
-
"targets": [
|
103
|
-
{ "os": "default", "uri": "https://docs.microsoft.com/outlook/actionable-messages" }
|
104
|
-
]
|
105
|
-
}
|
106
|
-
]
|
102
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
103
|
+
m.url = 'YOUR INCOMING WEBHOOK URL HERE'
|
104
|
+
m.text = 'Hello World!'
|
105
|
+
m.my_arbitrary_field = 'My value'
|
106
|
+
m.my_another_arbitrary_field = { my: 'value' }
|
107
107
|
end
|
108
108
|
|
109
|
-
|
110
|
-
|
109
|
+
message.send
|
110
|
+
```
|
111
|
+
|
112
|
+
- Addition of attribute after object initialization, but before `send` method call
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
116
|
+
|
117
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
118
|
+
m.url = 'YOUR INCOMING WEBHOOK URL HERE'
|
119
|
+
m.text = 'Hello World!'
|
120
|
+
end
|
121
|
+
|
122
|
+
message.builder.my_arbitrary_field = 'My value'
|
123
|
+
message.builder.my_another_arbitrary_field = { my: 'value' }
|
111
124
|
|
112
125
|
message.send
|
113
126
|
```
|
114
127
|
|
115
|
-
|
128
|
+
- Remotion of attributes after object initialization, but before `send` method call
|
129
|
+
|
130
|
+
```ruby
|
131
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
132
|
+
|
133
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
134
|
+
m.url = 'YOUR INCOMING WEBHOOK URL HERE'
|
135
|
+
m.text = 'Hello World!'
|
136
|
+
m.my_custom_field = 'My custom value'
|
137
|
+
end
|
116
138
|
|
117
|
-
|
139
|
+
message.builder.delete_field :my_custom_field
|
140
|
+
|
141
|
+
message.send
|
142
|
+
```
|
143
|
+
|
144
|
+
- Redefinition of attributes after object initialization, but before `send` method call
|
118
145
|
|
119
146
|
```ruby
|
120
|
-
|
147
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
148
|
+
|
149
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
150
|
+
m.url = 'YOUR INCOMING WEBHOOK URL HERE'
|
151
|
+
m.text = 'Hello World!'
|
152
|
+
m.my_custom_field = 'My custom value'
|
153
|
+
end
|
154
|
+
|
155
|
+
message.builder.my_custom_field = 'Updated value'
|
156
|
+
|
157
|
+
message.send
|
158
|
+
```
|
159
|
+
|
160
|
+
In case of keys that starts with **@**, it is necessary to use brackets notation:
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
164
|
+
|
165
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
166
|
+
m.url = 'YOUR INCOMING WEBHOOK URL HERE'
|
167
|
+
m.text = 'Hello World!'
|
168
|
+
m['@my_field'] = 'Lorem ipsum'
|
169
|
+
end
|
170
|
+
|
171
|
+
message.builder['@my_another_new_field'] = 'Ipsum valorium'
|
172
|
+
|
173
|
+
message.send
|
174
|
+
```
|
175
|
+
|
176
|
+
### Error handling
|
177
|
+
|
178
|
+
If the builder object turn itself invalid before invocation of `send` method, the gem will raise a `MicrosoftTeamsIncomingWebhookRuby::Message::Error::InvalidMessage` exception:
|
179
|
+
|
180
|
+
```ruby
|
181
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
182
|
+
|
183
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
184
|
+
m.url = 'YOUR INCOMING WEBHOOK URL HERE'
|
185
|
+
m.text = 'Hello World!'
|
186
|
+
end
|
187
|
+
|
188
|
+
message.builder.delete_field :url
|
189
|
+
|
190
|
+
begin
|
191
|
+
message.send
|
192
|
+
rescue MicrosoftTeamsIncomingWebhookRuby::Message::Error::InvalidMessage
|
193
|
+
puts 'Your message structure is invalid!'
|
194
|
+
end
|
195
|
+
```
|
196
|
+
|
197
|
+
```ruby
|
198
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
199
|
+
|
121
200
|
begin
|
122
|
-
|
123
|
-
|
124
|
-
|
201
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
202
|
+
m.my_only_one_field = 'Lorem ipsum'
|
203
|
+
end
|
204
|
+
rescue MicrosoftTeamsIncomingWebhookRuby::Message::Error::InvalidMessage
|
205
|
+
puts 'Your message structure is invalid'
|
206
|
+
end
|
207
|
+
```
|
208
|
+
|
209
|
+
If a non-successful response code be returned by API (1xx, 4xx or 5xx), the gem will raise a `MicrosoftTeamsIncomingWebhookRuby::Message::Error::FailedRequest` exception:
|
210
|
+
|
211
|
+
```ruby
|
212
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
213
|
+
|
214
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
215
|
+
m.url = 'YOUR INCOMING WEBHOOK URL HERE'
|
216
|
+
m.text = 'My message'
|
217
|
+
end
|
218
|
+
|
219
|
+
begin
|
220
|
+
message.send
|
221
|
+
rescue MicrosoftTeamsIncomingWebhookRuby::Message::Error::FailedRequest
|
222
|
+
puts 'Microsoft API is down, broken, or your network failed!'
|
223
|
+
end
|
224
|
+
```
|
225
|
+
|
226
|
+
## Examples
|
227
|
+
|
228
|
+
You can build and send messages with any supported card fields provided by Microsoft:
|
229
|
+
|
230
|
+
- https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using
|
231
|
+
- https://adaptivecards.io/samples
|
232
|
+
- https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference
|
233
|
+
- https://amdesigner.azurewebsites.net
|
234
|
+
- https://messagecardplayground.azurewebsites.net
|
235
|
+
- https://docs.microsoft.com/en-us/outlook/actionable-messages/adaptive-card
|
236
|
+
- https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/what-are-webhooks-and-connectors
|
237
|
+
|
238
|
+
We will provide below some ready-to-go examples to be used, based on API described in links above.
|
239
|
+
|
240
|
+
### Minimal
|
241
|
+
|
242
|
+
```ruby
|
243
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
244
|
+
|
245
|
+
webhook_url = 'YOUR INCOMING WEBHOOK URL HERE'
|
246
|
+
|
247
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
248
|
+
m.url = webhook_url
|
249
|
+
m.text = 'Minimal message!'
|
125
250
|
end
|
251
|
+
|
252
|
+
message.send
|
126
253
|
```
|
127
254
|
|
255
|
+
### Theme color
|
256
|
+
|
257
|
+
```ruby
|
258
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
259
|
+
|
260
|
+
webhook_url = 'YOUR INCOMING WEBHOOK URL HERE'
|
261
|
+
|
262
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
263
|
+
m.url = webhook_url
|
264
|
+
m.text = 'Message with theme color!'
|
265
|
+
m.themeColor = 'FF0000'
|
266
|
+
end
|
267
|
+
|
268
|
+
message.send
|
269
|
+
```
|
128
270
|
|
129
|
-
|
271
|
+
### Title
|
130
272
|
|
131
273
|
```ruby
|
132
|
-
|
133
|
-
|
134
|
-
|
274
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
275
|
+
|
276
|
+
webhook_url = 'YOUR INCOMING WEBHOOK URL HERE'
|
277
|
+
|
278
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
279
|
+
m.url = webhook_url
|
280
|
+
m.text = 'Message with title!'
|
281
|
+
m.title = 'My title'
|
135
282
|
end
|
136
283
|
|
137
|
-
|
284
|
+
message.send
|
285
|
+
```
|
286
|
+
|
287
|
+
### Summary
|
138
288
|
|
289
|
+
```ruby
|
290
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
291
|
+
|
292
|
+
webhook_url = 'YOUR INCOMING WEBHOOK URL HERE'
|
293
|
+
|
294
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
295
|
+
m.url = webhook_url
|
296
|
+
m.text = 'Message with summary!'
|
297
|
+
m.summary = 'My summary'
|
298
|
+
end
|
299
|
+
|
300
|
+
message.send
|
301
|
+
```
|
302
|
+
|
303
|
+
### Potential action
|
304
|
+
|
305
|
+
```ruby
|
306
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
307
|
+
|
308
|
+
webhook_url = 'YOUR INCOMING WEBHOOK URL HERE'
|
309
|
+
|
310
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
311
|
+
m.url = webhook_url
|
312
|
+
m.text = 'Message with potential action!'
|
313
|
+
m.potentialAction = [
|
314
|
+
{
|
315
|
+
'@type': 'ActionCard',
|
316
|
+
'name': 'Answer',
|
317
|
+
'inputs': [
|
318
|
+
{
|
319
|
+
'@type': 'TextInput',
|
320
|
+
'id': 'title',
|
321
|
+
'isMultiline': true,
|
322
|
+
'title': 'Your text here'
|
323
|
+
}
|
324
|
+
],
|
325
|
+
'actions': [
|
326
|
+
{
|
327
|
+
'@type': 'HttpPOST',
|
328
|
+
'name': 'Send my answer',
|
329
|
+
'isPrimary': true,
|
330
|
+
'target': 'https://example.com/example'
|
331
|
+
}
|
332
|
+
]
|
333
|
+
},
|
334
|
+
{
|
335
|
+
'@type': 'HttpPOST',
|
336
|
+
'name': 'Make another action',
|
337
|
+
'target': 'https://example.com/example2'
|
338
|
+
},
|
339
|
+
{
|
340
|
+
'@type': 'OpenUri',
|
341
|
+
'name': 'Open a URL',
|
342
|
+
'targets': [
|
343
|
+
{
|
344
|
+
'os': 'default',
|
345
|
+
'uri': 'https://github.com/pedrofurtado/microsoft_teams_incoming_webhook_ruby'
|
346
|
+
}
|
347
|
+
]
|
348
|
+
}
|
349
|
+
]
|
350
|
+
end
|
351
|
+
|
352
|
+
message.send
|
353
|
+
```
|
354
|
+
|
355
|
+
### Sections
|
356
|
+
|
357
|
+
```ruby
|
358
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
359
|
+
|
360
|
+
webhook_url = 'YOUR INCOMING WEBHOOK URL HERE'
|
361
|
+
|
362
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
363
|
+
m.url = webhook_url
|
364
|
+
m.text = 'Message with sections!'
|
365
|
+
m.sections = [
|
366
|
+
{
|
367
|
+
'text': 'Lorem ipsum vastium',
|
368
|
+
'activityTitle': 'John Smith',
|
369
|
+
'activitySubtitle': '01/01/1990, 11:45AM',
|
370
|
+
'activityImage': 'https://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg',
|
371
|
+
'facts': [
|
372
|
+
{ 'name': 'Repository:', 'value': 'my-repo' },
|
373
|
+
{ 'name': 'Issue #:', 'value': '123456789' }
|
374
|
+
]
|
375
|
+
}
|
376
|
+
]
|
377
|
+
end
|
378
|
+
|
379
|
+
message.send
|
380
|
+
```
|
381
|
+
|
382
|
+
### Advanced
|
383
|
+
|
384
|
+
```ruby
|
385
|
+
require 'microsoft_teams_incoming_webhook_ruby'
|
386
|
+
|
387
|
+
webhook_url = 'YOUR INCOMING WEBHOOK URL HERE'
|
388
|
+
|
389
|
+
message = MicrosoftTeamsIncomingWebhookRuby::Message.new do |m|
|
390
|
+
m.url = webhook_url
|
391
|
+
m.text = 'Advanced message'
|
392
|
+
m['@type'] = 'MessageCard'
|
393
|
+
m['@context'] = 'http://schema.org/extensions'
|
394
|
+
m.themeColor = '0076D7'
|
395
|
+
m.summary = 'Larry Bryant created a new task'
|
396
|
+
|
397
|
+
m.sections = [
|
398
|
+
{
|
399
|
+
'activityTitle': 'Larry Bryant created a new task',
|
400
|
+
'activitySubtitle': 'On Project Tango',
|
401
|
+
'activityImage': 'https://teamsnodesample.azurewebsites.net/static/img/image5.png',
|
402
|
+
'markdown': true,
|
403
|
+
'facts': [
|
404
|
+
{ 'name': 'Assigned to', 'value': 'Unassigned' },
|
405
|
+
{ 'name': 'Due date', 'value': 'Mon May 01 2017 17:07:18 GMT-0700 (Pacific Daylight Time)' },
|
406
|
+
{ 'name': 'Status', 'value': 'Not started' }
|
407
|
+
]
|
408
|
+
}
|
409
|
+
]
|
410
|
+
|
411
|
+
m.potentialAction = [
|
412
|
+
{
|
413
|
+
'@type': 'ActionCard',
|
414
|
+
'name': 'Add a comment',
|
415
|
+
'inputs': [
|
416
|
+
{
|
417
|
+
'@type': 'TextInput',
|
418
|
+
'id': 'comment',
|
419
|
+
'isMultiline': false,
|
420
|
+
'title': 'Add a comment here for this task'
|
421
|
+
}
|
422
|
+
],
|
423
|
+
'actions': [
|
424
|
+
{
|
425
|
+
'@type': 'HttpPOST',
|
426
|
+
'name': 'Add comment',
|
427
|
+
'target': 'https://docs.microsoft.com/outlook/actionable-messages'
|
428
|
+
}
|
429
|
+
]
|
430
|
+
},
|
431
|
+
{
|
432
|
+
'@type': 'ActionCard',
|
433
|
+
'name': 'Set due date',
|
434
|
+
'inputs': [
|
435
|
+
{
|
436
|
+
'@type': 'DateInput',
|
437
|
+
'id': 'dueDate',
|
438
|
+
'title': 'Enter a due date for this task'
|
439
|
+
}
|
440
|
+
],
|
441
|
+
'actions': [
|
442
|
+
{
|
443
|
+
'@type': 'HttpPOST',
|
444
|
+
'name': 'Save',
|
445
|
+
'target': 'https://docs.microsoft.com/outlook/actionable-messages'
|
446
|
+
}
|
447
|
+
]
|
448
|
+
},
|
449
|
+
{
|
450
|
+
'@type': 'OpenUri',
|
451
|
+
'name': 'Learn More',
|
452
|
+
'targets': [
|
453
|
+
{
|
454
|
+
'os': 'default',
|
455
|
+
'uri': 'https://docs.microsoft.com/outlook/actionable-messages'
|
456
|
+
}
|
457
|
+
]
|
458
|
+
},
|
459
|
+
{
|
460
|
+
'@type': 'ActionCard',
|
461
|
+
'name': 'Change status',
|
462
|
+
'inputs': [
|
463
|
+
{
|
464
|
+
'@type': 'MultichoiceInput',
|
465
|
+
'id': 'list',
|
466
|
+
'title': 'Select a status',
|
467
|
+
'isMultiSelect': 'false',
|
468
|
+
'choices': [
|
469
|
+
{ 'display': 'In Progress', 'value': '1' },
|
470
|
+
{ 'display': 'Active', 'value': '2' },
|
471
|
+
{ 'display': 'Closed', 'value': '3' }
|
472
|
+
]
|
473
|
+
}
|
474
|
+
],
|
475
|
+
'actions': [
|
476
|
+
{
|
477
|
+
'@type': 'HttpPOST',
|
478
|
+
'name': 'Save',
|
479
|
+
'target': 'https://docs.microsoft.com/outlook/actionable-messages'
|
480
|
+
}
|
481
|
+
]
|
482
|
+
}
|
483
|
+
]
|
484
|
+
end
|
485
|
+
|
486
|
+
message.send
|
139
487
|
```
|
140
488
|
|
141
489
|
## Execute tests/specs
|
@@ -153,18 +501,15 @@ docker build -t microsoft_teams_incoming_webhook_ruby_specs .
|
|
153
501
|
docker run -v $(pwd):/app/ -it microsoft_teams_incoming_webhook_ruby_specs
|
154
502
|
```
|
155
503
|
|
156
|
-
##
|
157
|
-
|
158
|
-
...
|
159
|
-
|
160
|
-
## Another similar gems for reference
|
504
|
+
## Similar gems for reference
|
161
505
|
|
162
|
-
There are similar open source libraries that shares the same purpose of this gem, such as:
|
506
|
+
There are similar and great open source libraries that shares the same purpose of this gem, such as:
|
163
507
|
|
164
508
|
- https://github.com/toririn/teams_incoming_clients
|
165
509
|
- https://github.com/shirts/microsoft-teams-ruby
|
166
510
|
- https://github.com/oooooooo/msteams-ruby-client
|
167
511
|
- https://github.com/eduardolagares/msteams_webhook
|
512
|
+
- https://github.com/adventistmedia/msteams_notifier
|
168
513
|
|
169
514
|
## Contributing
|
170
515
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'net/http'
|
4
4
|
require 'json'
|
5
|
+
require 'openssl'
|
5
6
|
|
6
7
|
module MicrosoftTeamsIncomingWebhookRuby
|
7
8
|
class Message
|
@@ -41,9 +42,10 @@ module MicrosoftTeamsIncomingWebhookRuby
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def send_by_http
|
44
|
-
uri
|
45
|
-
http
|
46
|
-
http.use_ssl
|
45
|
+
uri = URI.parse(@builder.url)
|
46
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
47
|
+
http.use_ssl = true
|
48
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
47
49
|
http.post(uri.path, @builder.to_h.to_json, 'Content-Type': 'application/json')
|
48
50
|
end
|
49
51
|
|
@@ -14,15 +14,11 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
15
15
|
spec.metadata["homepage_uri"] = spec.homepage
|
16
16
|
spec.metadata["source_code_uri"] = spec.homepage
|
17
|
-
spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
|
18
|
-
|
19
|
-
spec.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
spec.bindir = 'exe'
|
24
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
-
spec.require_paths = ['lib']
|
17
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) { `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } }
|
19
|
+
spec.bindir = 'exe'
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
26
22
|
|
27
23
|
spec.add_development_dependency 'rake'
|
28
24
|
spec.add_development_dependency 'rspec'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: microsoft_teams_incoming_webhook_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Furtado
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -112,7 +112,7 @@ licenses:
|
|
112
112
|
metadata:
|
113
113
|
homepage_uri: https://github.com/pedrofurtado/microsoft_teams_incoming_webhook_ruby
|
114
114
|
source_code_uri: https://github.com/pedrofurtado/microsoft_teams_incoming_webhook_ruby
|
115
|
-
changelog_uri: https://github.com/pedrofurtado/microsoft_teams_incoming_webhook_ruby/CHANGELOG.md
|
115
|
+
changelog_uri: https://github.com/pedrofurtado/microsoft_teams_incoming_webhook_ruby/blob/master/CHANGELOG.md
|
116
116
|
post_install_message:
|
117
117
|
rdoc_options: []
|
118
118
|
require_paths:
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
131
|
+
rubygems_version: 3.3.7
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Ruby gem for integration with Microsoft Teams Incoming Webhook
|