Constructor
new Contact()
Example
const sdk = await UA
const contact = await sdk.contact
// give the contact a name
await contact.identify("my-cool-user")
Members
Methods
(async) associateChannel(platform, channelId) → {Promise.<void>}
Associate an existing
Parameters:
Name | Type | Description |
---|---|---|
platform |
Platform
|
the platform |
channelId |
string
|
the channel id |
Returns:
- Type:
-
Promise.<void>
(async) editAttributes() → {Promise.<AttributeEditor>}
Create an attribute editor for the current contact.
Example
const editor = await contact.editAttributes()
editor.set("my_attribute", "some_value")
await editor.apply()
(async) editTags() → {Promise.<TagEditor>}
Create a tag editor for the current contact.
Example
const editor = await contact.editTags()
editor.add("my_group", ["tag1", "tag2"])
await editor.apply()
(async) identify(namedUserId) → {Promise.<void>}
Associates the contact with the given named user identifier.
Parameters:
Name | Type | Description |
---|---|---|
namedUserId |
string
|
identifier to apply to the channel |
Fires:
Returns:
- Type:
-
Promise.<void>
resolves if identifier was applied; rejects if it was unsuccessful.
(async) registerEmail(emailAddress, options) → {Promise.<void>}
Register an email channel to the contact.
Parameters:
Name | Type | Description |
---|---|---|
emailAddress |
the email address to register |
|
options |
email registration options |
Returns:
- Type:
-
Promise.<void>
(async) registerOpen(address, options) → {Promise.<void>}
Register an Open channel to the contact.
Parameters:
Name | Type | Description |
---|---|---|
address |
address of the device to register |
|
options |
open registration opens |
Returns:
- Type:
-
Promise.<void>
(async) registerSms(msisdn, options) → {Promise.<void>}
Register an SMS channel to the contact.
Parameters:
Name | Type | Description |
---|---|---|
msisdn |
mobile number (MSISDN) to register |
|
options |
SMS registration options |
Returns:
- Type:
-
Promise.<void>
(async) reset() → {Promise.<void>}
Disassociate the web channel from its current contact, and create a new un-named contact.
Returns:
- Type:
-
Promise.<void>
resolves if the reset was successful.
Events
conflict
The contact fires a conflict
event when a conflicting operation has taken
place, such as you naming a contact to a name that already exists within
Airship. While this would still name the contact, you may have had attributes
and tags that have been set which would conflict with the existing record.
So you may perform your own conflict resolution, we emit all available local
data along with the conflict
event.
Properties:
Name | Type | Description |
---|---|---|
ev.detail |
ConflictEvent
|
The known data about the contact prior to the conflict. |
Example
contact.addEventListener('conflict', ev => {
// perform conflict resolution
})