facebook-messenger 0.9.0 → 0.10.0
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/README.md +41 -6
- data/lib/facebook/messenger/incoming/message.rb +4 -2
- data/lib/facebook/messenger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e83e069691e11fa45a0f1ecd5259979b8384df3
|
4
|
+
data.tar.gz: 0e5572b7f3721288e1a909689e58228bc1cbfd27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46522d14a5293209b1161399e950b4d2858bd62ee7ce66724b08885ceb88c0b2bb2dff4aa9f6115dcb6afb68100f88549a1ca7a478a951735140cd32424ced96
|
7
|
+
data.tar.gz: 4d822bda06e656c2ea1241614ae866ee53334218f7bb9a2a232b69e68477a74b5377ad2c6b51f79759ac8c362fad2de53cd22c93a40ec8929d5742c5dd444c84
|
data/README.md
CHANGED
@@ -76,6 +76,28 @@ Bot.deliver(
|
|
76
76
|
)
|
77
77
|
```
|
78
78
|
|
79
|
+
##### Messages with quick replies
|
80
|
+
|
81
|
+
The human may appreciate hints:
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
Bot.deliver(
|
85
|
+
recipient: {
|
86
|
+
id: '45123'
|
87
|
+
},
|
88
|
+
message: {
|
89
|
+
text: 'Human, who is your favorite bot?'
|
90
|
+
quick_replies: [
|
91
|
+
{
|
92
|
+
content_type: 'text',
|
93
|
+
title: 'You are!',
|
94
|
+
payload: 'HARMLESS'
|
95
|
+
}
|
96
|
+
]
|
97
|
+
}
|
98
|
+
)
|
99
|
+
```
|
100
|
+
|
79
101
|
##### Messages with buttons
|
80
102
|
|
81
103
|
The human may require simple options to communicate:
|
@@ -118,6 +140,19 @@ end
|
|
118
140
|
|
119
141
|
*See Facebook's [documentation][message-documentation] for all message options.*
|
120
142
|
|
143
|
+
##### Typing indicator
|
144
|
+
|
145
|
+
Show the human you are preparing a message for them:
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
Bot.deliver(
|
149
|
+
recipient: {
|
150
|
+
id: '45123'
|
151
|
+
},
|
152
|
+
sender_action: 'typing_on'
|
153
|
+
)
|
154
|
+
```
|
155
|
+
|
121
156
|
#### Send to Facebook
|
122
157
|
|
123
158
|
When the human clicks the [Send to Messenger button][send-to-messenger-plugin]
|
@@ -307,13 +342,13 @@ end
|
|
307
342
|
|
308
343
|
Remember that Rails only eager loads everything in its production environment.
|
309
344
|
In the development and test environments, it only requires files as you
|
310
|
-
reference constants. You'll need to explicitly load `app/
|
345
|
+
reference constants. You'll need to explicitly load `app/bot`, then:
|
311
346
|
|
312
347
|
```ruby
|
313
348
|
# config/initializers/bot.rb
|
314
349
|
unless Rails.env.production?
|
315
|
-
bot_files = Dir[Rails.root.join('app', '
|
316
|
-
|
350
|
+
bot_files = Dir[Rails.root.join('app', 'bot', '**', '*.rb')]
|
351
|
+
bot_reloader = ActiveSupport::FileUpdateChecker.new(bot_files) do
|
317
352
|
bot_files.each{ |file| require_dependency file }
|
318
353
|
end
|
319
354
|
|
@@ -328,9 +363,9 @@ end
|
|
328
363
|
And add below code into `config/application.rb` to ensure rails knows bot files.
|
329
364
|
|
330
365
|
```ruby
|
331
|
-
# Auto-load
|
332
|
-
config.paths.add File.join('app', '
|
333
|
-
config.autoload_paths += Dir[Rails.root.join('app', '
|
366
|
+
# Auto-load the bot and its subdirectories
|
367
|
+
config.paths.add File.join('app', 'bot'), glob: File.join('**', '*.rb')
|
368
|
+
config.autoload_paths += Dir[Rails.root.join('app', 'bot', '*')]
|
334
369
|
```
|
335
370
|
|
336
371
|
To test your locally running bot, you can use [ngrok]. This will create a secure
|
@@ -37,8 +37,10 @@ module Facebook
|
|
37
37
|
@messaging['message']['attachments']
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
41
|
-
@messaging['message']['quick_reply']
|
40
|
+
def quick_reply
|
41
|
+
return unless @messaging['message']['quick_reply']
|
42
|
+
|
43
|
+
@messaging['message']['quick_reply']['payload']
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facebook-messenger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Gorset
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|