stealth-facebook 0.13.2 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -6
- data/README.md +42 -6
- data/VERSION +1 -1
- data/lib/stealth/services/facebook/reply_handler.rb +22 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11c3547b103d3baf55fd0ca80f8aa95819e9b3cf92c526ad895cb8f8020f5ea9
|
4
|
+
data.tar.gz: 17e7eb35d6d16a9ed7d1513ea8cda15df5a2e88fe3a53f576ae6be69139d733f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db00e909d2843c39d74a7d61a557eee03ec6fd067c264bd0112c65236318452b56787d868704ed37f279b4d31c0f257d3fe5b0c5c783dc7b773b0d45f569eaf2
|
7
|
+
data.tar.gz: 0c01e28b2b1cd35901f9da13c236ac6589a4a26bc607f2b14d903ff81b41c319e7b585f5663a0f1072b6147d2de0939481acd3903f933a2957ca5d3e50048791
|
data/Gemfile.lock
CHANGED
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
diff-lcs (1.3)
|
19
19
|
faraday (0.15.4)
|
20
20
|
multipart-post (>= 1.2, < 3)
|
21
|
-
i18n (1.
|
21
|
+
i18n (1.5.3)
|
22
22
|
concurrent-ruby (~> 1.0)
|
23
23
|
minitest (5.11.3)
|
24
24
|
multi_json (1.13.1)
|
@@ -26,7 +26,7 @@ GEM
|
|
26
26
|
mustermann (1.0.3)
|
27
27
|
puma (3.12.0)
|
28
28
|
rack (2.0.6)
|
29
|
-
rack-protection (2.0.
|
29
|
+
rack-protection (2.0.5)
|
30
30
|
rack
|
31
31
|
rack-test (1.1.0)
|
32
32
|
rack (>= 1.0, < 3)
|
@@ -46,16 +46,17 @@ GEM
|
|
46
46
|
rspec-support (3.8.0)
|
47
47
|
rspec_junit_formatter (0.4.1)
|
48
48
|
rspec-core (>= 2, < 4, != 2.12.0)
|
49
|
-
sidekiq (5.2.
|
49
|
+
sidekiq (5.2.5)
|
50
50
|
connection_pool (~> 2.2, >= 2.2.2)
|
51
|
+
rack (>= 1.5.0)
|
51
52
|
rack-protection (>= 1.5.0)
|
52
53
|
redis (>= 3.3.5, < 5)
|
53
|
-
sinatra (2.0.
|
54
|
+
sinatra (2.0.5)
|
54
55
|
mustermann (~> 1.0)
|
55
56
|
rack (~> 2.0)
|
56
|
-
rack-protection (= 2.0.
|
57
|
+
rack-protection (= 2.0.5)
|
57
58
|
tilt (~> 2.0)
|
58
|
-
stealth (1.1.
|
59
|
+
stealth (1.1.6)
|
59
60
|
activesupport (~> 5.2)
|
60
61
|
multi_json (~> 1.12)
|
61
62
|
puma (~> 3.10)
|
data/README.md
CHANGED
@@ -179,14 +179,14 @@ These are standard text replies. It can sent like:
|
|
179
179
|
|
180
180
|
```yaml
|
181
181
|
- reply_type: text
|
182
|
-
text: Hello World!
|
182
|
+
text: "Hello World!"
|
183
183
|
```
|
184
184
|
|
185
185
|
Text replies can also include suggestions, which will be rendered as quick replies:
|
186
186
|
|
187
187
|
```yaml
|
188
188
|
- reply_type: text
|
189
|
-
text: What is your favorite color?
|
189
|
+
text: "What is your favorite color?"
|
190
190
|
suggestions:
|
191
191
|
- text: Blue
|
192
192
|
- text: Red
|
@@ -196,7 +196,7 @@ Although not as common, text replies can also include buttons:
|
|
196
196
|
|
197
197
|
```yaml
|
198
198
|
- reply_type: text
|
199
|
-
text: Would you like to give us a call?
|
199
|
+
text: "Would you like to give us a call?"
|
200
200
|
buttons:
|
201
201
|
- type: call
|
202
202
|
phone_number: "+15552991212"
|
@@ -280,7 +280,7 @@ This is the most common button type. When a user presses a button that is `paylo
|
|
280
280
|
|
281
281
|
```yaml
|
282
282
|
- reply_type: text
|
283
|
-
text: Please press the button below
|
283
|
+
text: "Please press the button below"
|
284
284
|
buttons:
|
285
285
|
- type: payload
|
286
286
|
text: 'Press me!'
|
@@ -296,25 +296,29 @@ The `url` button is useful when sharing a link to a website. By default, it will
|
|
296
296
|
|
297
297
|
```yaml
|
298
298
|
- reply_type: text
|
299
|
-
text: Find out more via our website
|
299
|
+
text: "Find out more via our website"
|
300
300
|
buttons:
|
301
301
|
- type: url
|
302
302
|
text: 'Visit website'
|
303
303
|
url: 'https://example.org'
|
304
|
+
messenger_extensions: true
|
304
305
|
|
305
306
|
```
|
306
307
|
|
308
|
+
Enabling messenger_extensions allows your webview to access a selection of features from the Messenger platform. More info [here](https://developers.facebook.com/docs/messenger-platform/webview/extensions?source=post_page). Without this parameter set to true, the webview opens in a separate tab or window if a user is visiting from the 'messenger.com' domain.
|
309
|
+
|
307
310
|
You can also specify the height of the webview window that opens up in Messenger via: `webview_height`. You can choose between `compact`, `tall`, and `full`.
|
308
311
|
|
309
312
|
More info [here](https://developers.facebook.com/docs/messenger-platform/webview).
|
310
313
|
|
314
|
+
|
311
315
|
#### call
|
312
316
|
|
313
317
|
The `call` button type will prompt the user to dial the specified number. The number will be pre-filled in, but the user will still have to confirm by confirming via the modal that is shown. To create a `call` button:
|
314
318
|
|
315
319
|
```yaml
|
316
320
|
- reply_type: text
|
317
|
-
text: Give us a ring!
|
321
|
+
text: "Give us a ring!"
|
318
322
|
buttons:
|
319
323
|
- type: call
|
320
324
|
text: 'Call'
|
@@ -448,3 +452,35 @@ To send an audio clip:
|
|
448
452
|
The `audio_url` should be set to URL where the video has been uploaded.
|
449
453
|
|
450
454
|
Audio replies support buttons and suggestions like text replies.
|
455
|
+
|
456
|
+
### Account Linking
|
457
|
+
|
458
|
+
Account Linking allows you to invite users to log-in using your own authentication flow, and to receive a Messenger page-scoped ID (PSID) upon completion. You can find more info about Facebook Account Linking [here](https://developers.facebook.com/docs/messenger-platform/identity/account-linking).
|
459
|
+
|
460
|
+
#### Login
|
461
|
+
|
462
|
+
The `login` button type will prompt the user to log-in using your own authentication flow in the case he or she has an account with your business. You can find more info about Facebook Log In Button [here](https://developers.facebook.com/docs/messenger-platform/reference/buttons/login).
|
463
|
+
|
464
|
+
To create a `login` button:
|
465
|
+
|
466
|
+
```yaml
|
467
|
+
- reply_type: text
|
468
|
+
text: "Log in to access your account information."
|
469
|
+
buttons:
|
470
|
+
- type: login
|
471
|
+
url: "https://my-app.com/login"
|
472
|
+
```
|
473
|
+
|
474
|
+
#### Logout
|
475
|
+
|
476
|
+
The `logout` button type is used in the account linking flow to unlink the message recipient's identity on Messenger with their account on your site. You can find more info about Facebook Log Out Button [here](https://developers.facebook.com/docs/messenger-platform/reference/buttons/logout).
|
477
|
+
|
478
|
+
To create a `logout` button:
|
479
|
+
|
480
|
+
```yaml
|
481
|
+
- reply_type: text
|
482
|
+
text: "Log out"
|
483
|
+
buttons:
|
484
|
+
- type: logout
|
485
|
+
```
|
486
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.14.0
|
@@ -391,34 +391,49 @@ module Stealth
|
|
391
391
|
fb_buttons = buttons.collect do |button|
|
392
392
|
case button['type']
|
393
393
|
when 'url'
|
394
|
-
|
394
|
+
_button = {
|
395
395
|
"type" => "web_url",
|
396
396
|
"url" => button["url"],
|
397
397
|
"title" => button["text"]
|
398
398
|
}
|
399
399
|
|
400
400
|
if button["webview_height"].present?
|
401
|
-
|
401
|
+
_button["webview_height_ratio"] = button["webview_height"]
|
402
402
|
end
|
403
403
|
|
404
|
-
button
|
404
|
+
if button['messenger_extensions'].present?
|
405
|
+
_button['messenger_extensions'] = true
|
406
|
+
end
|
407
|
+
|
408
|
+
_button
|
405
409
|
|
406
410
|
when 'payload'
|
407
|
-
|
411
|
+
_button = {
|
408
412
|
"type" => "postback",
|
409
413
|
"payload" => button["payload"],
|
410
414
|
"title" => button["text"]
|
411
415
|
}
|
412
416
|
|
413
417
|
when 'call'
|
414
|
-
|
418
|
+
_button = {
|
415
419
|
"type" => "phone_number",
|
416
420
|
"payload" => button["phone_number"],
|
417
421
|
"title" => button["text"]
|
418
422
|
}
|
419
423
|
|
424
|
+
when 'login'
|
425
|
+
_button = {
|
426
|
+
"type" => "account_link",
|
427
|
+
"url" => button["url"]
|
428
|
+
}
|
429
|
+
|
430
|
+
when 'logout'
|
431
|
+
_button = {
|
432
|
+
"type" => "account_unlink"
|
433
|
+
}
|
434
|
+
|
420
435
|
when 'nested'
|
421
|
-
|
436
|
+
_button = {
|
422
437
|
"type" => "nested",
|
423
438
|
"title" => button["text"],
|
424
439
|
"call_to_actions" => generate_buttons(buttons: button["buttons"])
|
@@ -428,7 +443,7 @@ module Stealth
|
|
428
443
|
raise(Stealth::Errors::ServiceImpaired, "Sorry, we don't yet support #{button["type"]} buttons yet!")
|
429
444
|
end
|
430
445
|
|
431
|
-
|
446
|
+
_button
|
432
447
|
end
|
433
448
|
|
434
449
|
fb_buttons
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stealth-facebook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mauricio Gomes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stealth
|