Skip to content

Commit 5fcfdf5

Browse files
committed
Groups and aliases
1 parent 0bc40f9 commit 5fcfdf5

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,27 @@ You can also disable a previously registered device tokens.
6363
### User ID
6464
- A user ID must ALWAYS be a string or a number. Anything else will trigger an error and the call will not be sent to Outbound. User IDs are always stored as strings. Keep this in mind if you have different types. A user with ID of 1 (the number) will be considered the same as user with ID of "1" (the string).
6565
- A user ID should be static. It should be the same value you use to identify the user in your own system.
66+
- Some times you don't have a user id yet for a user but you still want to identify them and trigger events for them. You can do this by generating a new ID (call this the anonymous ID) and identify the user as you normally would. Then, once the user becomes a real, identifiable user and you have a real ID for them, make another identify call, this time pass in the anonymous ID as the previous ID.
67+
68+
user_info = {
69+
:previous_id => anonymous_id,
70+
}
71+
Outbound.identify("USER ID", user_info)
72+
73+
### Groups
74+
You can create a set of attributes and have them be inherited by a group of users. This can all be done with the `identify` call.
75+
76+
user_info = {
77+
:group_id => 'group identifier',
78+
:group_attributes => {
79+
... attributes shared by the group ...
80+
}
81+
}
82+
Outbound.identify("USER ID", user_info)
83+
84+
- Group IDs are treated just like user IDs. They should only be strings or numbers.
85+
- Users in a group will inherit group attributes but user attributes take precedences. So if there is an attribute `state` set on the group and it is set to "California" and there is also a `state` attribute set on the user but set to "New York", the value for that user is "New York". If the user didn't have that attribute, the value of `state` for that user would be the group value which is "California".
86+
- You only need to pass in the group attributes when they are initially set or when they are updated but you do need to set the group id for each user you want to be in the group.
6687

6788
### Event Name
6889
- An event name in a track can only be a string. Any other type of value will trigger an error and the call will not be sent to Outbound.

lib/outbound.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require 'uri'
55

66
module Outbound
7-
VERSION = '0.3.2'
7+
VERSION = '0.4.0'
88
BASE_URL = 'https://api.outbound.io/v2'
99

1010
APNS = "apns"
@@ -256,6 +256,9 @@ def user info={}, attributes={}
256256
:phone_number => info[:phone_number],
257257
:apns => info[:apns_tokens],
258258
:gcm => info[:gcm_tokens],
259+
:group_id => info[:group_id],
260+
:group_attributes => info[:group_attributes],
261+
:previous_id => info[:previous_id],
259262
:attributes => attributes,
260263
}
261264
return user.delete_if { |k, v| v.nil? || v.empty? }

0 commit comments

Comments
 (0)