Contacts

A Contact is any user in your project. Contacts are identified as either an Anonymous Contact or a Named User. Airship can set targeting data on these identifiers, which are also used to map devices and channels to a specific user.

About Contacts

While a Contact can be associated with multiple devices, such as a user’s tablet and phone, a device can only be associated with a single Contact.

When you name a Contact, you are assigning a Named UserA customer-provided identifier used for mapping multiple devices and channels to a specific individual. ID to the contact. Identifying a contact as a Named User allows you to modify the Contact through Named User APIs and use the Named User ID for segmentation.

Anonymous Contacts still allow tags, attributes, subscription lists, and channel association.

When a Contact goes from anonymous to named, the anonymous data will automatically carry over to the Named User ID, if the Named User is new. If the Named User already exists, a conflict event will be emitted by the SDK and the app is responsible for migrating anonymous data to the existing Named User.

Managing the Contact’s identifier (Named User ID)

With the mobile SDKS, identify can be called multiple times with the same Named User ID. The SDK will automatically deduplicate identify calls made with the same Named User ID. If the ID is changed from a previous value, the Contact will automatically be dissociated from the previous Named User ID.

Identifying the contact

Airship.contact.identify("some named user ID")
Airship.getContact().identify("some named user ID");
Airship.contact.identify("some named user ID")
[UAirship.contact identify:@"some named user ID"];
await Airship.contact.identify(namedUserId);
Airship.contact.identify(namedUserId);
Airship.contact.identify(namedUserId);
await Airship.contact.identify(namedUserId)
using AirshipDotNet;

Airship.Instance.IdentifyContact("some named user ID");
using UrbanAirship.NETStandard;

Airship.Instance.IdentifyContact("some named user ID");
Airship.contact.identify("some named user ID");
UAirship.Shared.NamedUserId = "some named user ID";

If the user logs out of the device, you may want to reset the contact. This will clear any anonymous data and dissociate the contact from the Named User ID, if set. This should only be called when the user manually logs out of the app, otherwise you will not be able to target the Channel by its Contact data.

Resetting the contact

Airship.contact.reset()
Airship.getContact().reset();
Airship.contact.reset()
[UAirship.contact reset];
await Airship.contact.reset();
Airship.contact.reset();
Airship.contact.reset();
await Airship.contact.reset()
using AirshipDotNet;

Airship.Instance.ResetContact();
using UrbanAirship.NETStandard;

Airship.Instance.ResetContact();
Airship.contact.reset();
UAirship.Shared.NamedUserId = null;

When you name a Contact, you are assigning a Named User ID to the contact. You can get the Named User ID only if you set it through the SDK.

Getting the Named User ID

Airship.contact.namedUserId
Airship.getContact().getNamedUserId();
await Airship.contact.namedUserID
[UAirship.contact getNamedUserIDWithCompletionHandler:^(NSString *namedUserID) {

}];
const namedUser = await Airship.contact.getNamedUserId();
await Airship.contact.namedUserId;
Airship.contact.getNamedUserId((namedUser) => {
    if (namedUser) {
        console.log("Named User ID: " + namedUser)
    }
});
const namedUser = await Airship.contact.getNamedUserId()
using AirshipDotNet;

Airship.Instance.NamedUser;
using UrbanAirship.NETStandard;

Airship.Instance.GetNamedUser(namedUser =>
{ 
    // Use the namedUser
});
Airship.contact.namedUserId;
UAirship.Shared.NamedUserId

Email channel association

When an email address is registered through the SDK, it will be registered for both transactional and commercial emails by default. To change this behavior, you can override the options to request Double Opt-InA process where users who sign up for messaging must confirm opting in before they can receive messages. for commercial messages.

Associating an email channel

val properties = JsonMap.newBuilder().put("place", "paris").build()
val options = EmailRegistrationOptions.commercialOptions(commercialDate, transactionalDate, properties)
Airship.contact.registerEmail("your@example.com", options)
JsonMap properties = JsonMap.newBuilder().put("place", "paris").build();
EmailRegistrationOptions options = EmailRegistrationOptions.commercialOptions(commercialDate, transactionalDate, properties);
Airship.getContact().registerEmail("your@example.com", options);
let options = EmailRegistrationOptions.commercialOptions(
    transactionalOptedIn: transactionalDate,
    commercialOptedIn: commercialDate,
    properties: properties
)
Airship.contact.registerEmail("your@example.com", options: options)
UAEmailRegistrationOptions* options = [UAEmailRegistrationOptions commercialOptionsWithTransactionalOptedIn:transactionalDate commercialOptedIn:commercialDate properties:properties];
[UAirship.contact registerEmail:@"your@example.com" options:options];
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported

SMS channel association

When an MSISDNThe mobile phone number, including country code, of a device in your Airship audience. Each MSISDN represents an individual mobile device. is registered through the SDK, Airship sends a message to that number, prompting them to opt in. For more information, see the SMS platform documentation: Non-Mobile Double Opt-In.

Associating an SMS channel

val options = SmsRegistrationOptions.options("senderId")
Airship.contact.registerSms("yourMsisdn", options)
SmsRegistrationOptions options = SmsRegistrationOptions.options("senderId");
Airship.getContact().registerSms("yourMsisdn", options);
let options = SMSRegistrationOptions.optIn(senderID: "senderId")
Airship.contact.registerSMS("yourMsisdn", options: options)
UASMSRegistrationOptions* options = [UASMSRegistrationOptions optInSenderID:@"senderId"];
[UAirship.contact registerSMS:"yourMsisdn" options:options];
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported

Open Channel association

Open Channels support notifications to any medium that can accept a JSON payload, through either the Airship API or web dashboard. For more information about Open Channels, see the Open Channels documentation.

Associating an Open Channel

val options = OpenChannelRegistrationOptions.options("platformName")
Airship.contact.registerOpenChannel("address", options)
OpenChannelRegistrationOptions options = OpenChannelRegistrationOptions.options("platformName");
Airship.getContact().registerOpenChannel("address", options);
let options = OpenRegistrationOptions.optIn(platformName: "platformName", identifiers: identifiers)
Airship.contact.registerOpen("address", options: options)
UAOpenRegistrationOptions* options = [UAOpenRegistrationOptions optInSenderID:@"platformName"];
[UAirship.contact registerOpen:"address" options:options];
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported
// Not supported