Skip to content

Commit d888fef

Browse files
committedSep 21, 2020
Merge remote-tracking branch 'origin/master' into master
2 parents 06fc75b + a55ae8c commit d888fef

File tree

3 files changed

+53
-7
lines changed

3 files changed

+53
-7
lines changed
 

‎README.md

+42-6
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ These are standard text replies. It can sent like:
189189

190190
```yaml
191191
- reply_type: text
192-
text: Hello World!
192+
text: "Hello World!"
193193
```
194194

195195
Text replies can also include suggestions, which will be rendered as quick replies:
196196

197197
```yaml
198198
- reply_type: text
199-
text: What is your favorite color?
199+
text: "What is your favorite color?"
200200
suggestions:
201201
- text: Blue
202202
- text: Red
@@ -206,7 +206,7 @@ Text replies can also include buttons:
206206

207207
```yaml
208208
- reply_type: text
209-
text: Would you like to give us a call?
209+
text: "Would you like to give us a call?"
210210
buttons:
211211
- type: call
212212
phone_number: "+15552991212"
@@ -292,7 +292,7 @@ This is the most common button type. When a user presses a button that is `paylo
292292

293293
```yaml
294294
- reply_type: text
295-
text: Please press the button below
295+
text: "Please press the button below"
296296
buttons:
297297
- type: payload
298298
text: 'Press me!'
@@ -308,25 +308,29 @@ The `url` button is useful when sharing a link to a website. By default, it will
308308

309309
```yaml
310310
- reply_type: text
311-
text: Find out more via our website
311+
text: "Find out more via our website"
312312
buttons:
313313
- type: url
314314
text: 'Visit website'
315315
url: 'https://example.org'
316+
messenger_extensions: true
316317
317318
```
318319

320+
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.
321+
319322
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`.
320323

321324
More info [here](https://developers.facebook.com/docs/messenger-platform/webview).
322325

326+
323327
#### call
324328

325329
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:
326330

327331
```yaml
328332
- reply_type: text
329-
text: Give us a ring!
333+
text: "Give us a ring!"
330334
buttons:
331335
- type: call
332336
text: 'Call'
@@ -460,3 +464,35 @@ To send an audio clip:
460464
The `audio_url` should be set to URL where the video has been uploaded.
461465

462466
Audio replies support buttons and suggestions like text replies.
467+
468+
### Account Linking
469+
470+
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).
471+
472+
#### Login
473+
474+
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).
475+
476+
To create a `login` button:
477+
478+
```yaml
479+
- reply_type: text
480+
text: "Log in to access your account information."
481+
buttons:
482+
- type: login
483+
url: "https://my-app.com/login"
484+
```
485+
486+
#### Logout
487+
488+
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).
489+
490+
To create a `logout` button:
491+
492+
```yaml
493+
- reply_type: text
494+
text: "Log out"
495+
buttons:
496+
- type: logout
497+
```
498+

‎lib/stealth/services/facebook/reply_handler.rb

+11
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,17 @@ def generate_buttons(buttons:)
427427
"title" => button["text"]
428428
}
429429

430+
when 'login'
431+
_button = {
432+
"type" => "account_link",
433+
"url" => button["url"]
434+
}
435+
436+
when 'logout'
437+
_button = {
438+
"type" => "account_unlink"
439+
}
440+
430441
when 'nested'
431442
_button = {
432443
"type" => "nested",

‎stealth-facebook.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Gem::Specification.new do |s|
1515
s.add_dependency 'stealth', '>= 2.0.0.beta'
1616
s.add_dependency 'http', '~> 4.4'
1717

18-
s.add_development_dependency 'rspec', '~> 3'
1918
s.add_development_dependency 'rspec_junit_formatter', '~> 0.3'
2019
s.add_development_dependency 'rack-test', '~> 1.1'
2120

0 commit comments

Comments
 (0)
Please sign in to comment.