stealth-facebook 0.10.3 → 0.11.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 +33 -0
- data/VERSION +1 -1
- data/lib/stealth/services/facebook/client.rb +2 -2
- 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: bf2ef304f3c6e483aa969d7978ec498c5aab684f8a6d2f4060df92b8cf592eaf
|
4
|
+
data.tar.gz: ffb4f5b2d8e8186fd4d8ccc210878dc8765796b0cf4a722853edf5692911d092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f848d03ed2e5b7c2b692c04592051891e0adba30e8259110122b633bcd4e60a1026e534006b0fa4dd60edcb0713155654b848c406f77a8c3b2eabac8e59f36dd
|
7
|
+
data.tar.gz: fcbf1093cefaa3797bc3e85a421ee7742169eb499fe6035ad13491b503ba830ff82317726bc6132d57fb852b01da96e8294a26dc10b13187446c0a74acafce92
|
data/README.md
CHANGED
@@ -93,6 +93,39 @@ Each time you make a change to the persistent menu, you will have to upload the
|
|
93
93
|
stealth setup facebook
|
94
94
|
```
|
95
95
|
|
96
|
+
### Profile Data
|
97
|
+
|
98
|
+
By default, your Facebook bots may retrieve the `id`, `name`, `first_name`, `last_name`, and `profile_pic` fields for users that have made this information public and have opted-in to your bot. More info [here](https://developers.facebook.com/docs/messenger-platform/identity/user-profile).
|
99
|
+
|
100
|
+
To fetch a user's profile with `stealth-facebook` you can call the following:
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
fb_profile = Stealth::Services::Facebook::Client.fetch_profile(
|
104
|
+
recipient_id: current_user_id
|
105
|
+
)
|
106
|
+
```
|
107
|
+
|
108
|
+
`fb_profile` is a hash that contains the fields above:
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
{
|
112
|
+
'id' => 1464633220279330,
|
113
|
+
'name' => "Carol Robbins",
|
114
|
+
'first_name' => "Carol",
|
115
|
+
'last_name' => "Robbins",
|
116
|
+
'profile_pic' => "https://platform-lookaside.fbsbx.com/platform/profilepic/?psid=1464633220279330&width=1024&ext=1537650777&hash=AeQzWeTgFqlAyiye"
|
117
|
+
}
|
118
|
+
```
|
119
|
+
|
120
|
+
If your bot has permission to retrieve additional fields, you can specify them as an array of symbols via the `fields` argument:
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
fb_profile = Stealth::Services::Facebook::Client.fetch_profile(
|
124
|
+
recipient_id: current_user_id,
|
125
|
+
fields: [:id, :name, :first_name, :last_name, :profile_pic, :gender, :locale]
|
126
|
+
)
|
127
|
+
```
|
128
|
+
|
96
129
|
## Replies
|
97
130
|
|
98
131
|
Here are the supported replies for the Facebook integration:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
@@ -30,7 +30,7 @@ module Stealth
|
|
30
30
|
|
31
31
|
def self.fetch_profile(recipient_id:, fields: nil)
|
32
32
|
if fields.blank?
|
33
|
-
fields = [:
|
33
|
+
fields = [:id, :name, :first_name, :last_name, :profile_pic]
|
34
34
|
end
|
35
35
|
|
36
36
|
query_hash = {
|
@@ -40,7 +40,7 @@ module Stealth
|
|
40
40
|
|
41
41
|
uri = URI::HTTPS.build(
|
42
42
|
host: "graph.facebook.com",
|
43
|
-
path: "
|
43
|
+
path: "/#{recipient_id}",
|
44
44
|
query: query_hash.to_query
|
45
45
|
)
|
46
46
|
|
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.11.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: 2018-
|
11
|
+
date: 2018-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stealth
|