facebook-messenger 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +15 -1
- data/lib/facebook/messenger/bot.rb +1 -0
- data/lib/facebook/messenger/incoming.rb +3 -1
- data/lib/facebook/messenger/incoming/common.rb +2 -2
- data/lib/facebook/messenger/incoming/message_reaction.rb +23 -0
- data/lib/facebook/messenger/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ebc5c554cf126d4bede7529e7d0f6631392d0139c6d6debe6ad571920074b568
|
4
|
+
data.tar.gz: a8c4575d7c13c832ec025c3c17e60621719a601fd53525a26a3b0471a1414f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72f092cb6b509972da3f52b39713449a122093fd22b2e3cddf2dcf64f2ee6679410fdf997bb6a64c7320fd2412f75e4e90dd1f989d1b5a675dfe778c60bf46b7
|
7
|
+
data.tar.gz: 7c4411c10d3e77c739c00e36ced312f2885669abd3ae77ef62c4f4392e78fb051a9c54de9a96a3684aa400df9808f3467f7a5be597b17d670d58b1bce5200229
|
data/README.md
CHANGED
@@ -57,7 +57,7 @@ NOTE: `app_secret_proof` is an optional parameter to [secure your requests](http
|
|
57
57
|
and you can generate it from your configuration provider like so:
|
58
58
|
|
59
59
|
```ruby
|
60
|
-
configuration_provider = Facebook::Messenger::Configuration::Providers
|
60
|
+
configuration_provider = Facebook::Messenger::Configuration::Providers::Environment.new
|
61
61
|
app_secret_proof = configuration_provider.app_secret_proof_for(page_id)
|
62
62
|
```
|
63
63
|
|
@@ -133,6 +133,20 @@ end
|
|
133
133
|
|
134
134
|
*See Facebook's [documentation][message-documentation] for all message options.*
|
135
135
|
|
136
|
+
##### Reactions
|
137
|
+
|
138
|
+
Humans have feelings, and they can react to your messages. You can pretend to understand:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
Bot.on :reaction do |message|
|
142
|
+
message.emoji # => "👍"
|
143
|
+
message.action # => "react"
|
144
|
+
message.reaction # => "like"
|
145
|
+
|
146
|
+
message.reply(text: 'Your feelings have been registered')
|
147
|
+
end
|
148
|
+
```
|
149
|
+
|
136
150
|
##### Typing indicator
|
137
151
|
|
138
152
|
Show the human you are preparing a message for them:
|
@@ -12,6 +12,7 @@ require 'facebook/messenger/incoming/payment'
|
|
12
12
|
require 'facebook/messenger/incoming/policy_enforcement'
|
13
13
|
require 'facebook/messenger/incoming/pass_thread_control'
|
14
14
|
require 'facebook/messenger/incoming/game_play'
|
15
|
+
require 'facebook/messenger/incoming/message_reaction'
|
15
16
|
|
16
17
|
module Facebook
|
17
18
|
module Messenger
|
@@ -35,7 +36,8 @@ module Facebook
|
|
35
36
|
'payment' => Payment,
|
36
37
|
'policy_enforcement' => PolicyEnforcement,
|
37
38
|
'pass_thread_control' => PassThreadControl,
|
38
|
-
'game_play' => GamePlay
|
39
|
+
'game_play' => GamePlay,
|
40
|
+
'reaction' => MessageReaction
|
39
41
|
}.freeze
|
40
42
|
|
41
43
|
# Parse the given payload and create new object of class related
|
@@ -18,6 +18,7 @@ module Facebook
|
|
18
18
|
|
19
19
|
#
|
20
20
|
# Function return PSID of sender.
|
21
|
+
#
|
21
22
|
# @see https://developers.facebook.com/docs/messenger-platform/identity
|
22
23
|
# Info about PSID.
|
23
24
|
# @see https://developers.facebook.com/docs/messenger-platform/webhook#format
|
@@ -30,7 +31,7 @@ module Facebook
|
|
30
31
|
end
|
31
32
|
|
32
33
|
#
|
33
|
-
# Function return the page
|
34
|
+
# Function return id of the page from which the message has arrived.
|
34
35
|
#
|
35
36
|
# @return [String] Facebook page id.
|
36
37
|
#
|
@@ -54,7 +55,6 @@ module Facebook
|
|
54
55
|
#
|
55
56
|
# Function return timestamp when message is sent.
|
56
57
|
#
|
57
|
-
#
|
58
58
|
# @return [Object] Message time sent.
|
59
59
|
#
|
60
60
|
def sent_at
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Facebook
|
2
|
+
module Messenger
|
3
|
+
module Incoming
|
4
|
+
# The Message echo class represents an incoming Facebook Messenger message
|
5
|
+
# @see https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/message-reactions
|
6
|
+
class MessageReaction
|
7
|
+
include Facebook::Messenger::Incoming::Common
|
8
|
+
|
9
|
+
def action
|
10
|
+
@messaging['reaction']['action']
|
11
|
+
end
|
12
|
+
|
13
|
+
def emoji
|
14
|
+
@messaging['reaction']['emoji']
|
15
|
+
end
|
16
|
+
|
17
|
+
def reaction
|
18
|
+
@messaging['reaction']['reaction']
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
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: 1.
|
4
|
+
version: 1.5.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:
|
11
|
+
date: 2020-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 12.3.3
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
116
|
+
version: 12.3.3
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: rspec
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,6 +186,7 @@ files:
|
|
186
186
|
- lib/facebook/messenger/incoming/game_play.rb
|
187
187
|
- lib/facebook/messenger/incoming/message.rb
|
188
188
|
- lib/facebook/messenger/incoming/message_echo.rb
|
189
|
+
- lib/facebook/messenger/incoming/message_reaction.rb
|
189
190
|
- lib/facebook/messenger/incoming/message_request.rb
|
190
191
|
- lib/facebook/messenger/incoming/optin.rb
|
191
192
|
- lib/facebook/messenger/incoming/pass_thread_control.rb
|
@@ -219,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
220
|
version: '0'
|
220
221
|
requirements: []
|
221
222
|
rubyforge_project:
|
222
|
-
rubygems_version: 2.6
|
223
|
+
rubygems_version: 2.7.6
|
223
224
|
signing_key:
|
224
225
|
specification_version: 4
|
225
226
|
summary: Facebook Messenger client
|