Trigger Events

You can trigger events from client to SuprSend using track method. This can be used to trigger event-based workflows.
await SuprSend.shared.track(event: String, properties: [String: Any]?)
Returns: async -> APIResponse

Update User Profile

Returns: async -> APIResponse

Update User channels

Set user channel related information using following methods. Its recommended to use SuprSend’s Backend SDK’s to set user channels instead of Client SDK’s.
await SuprSend.shared.user.addEmail(String)
await SuprSend.shared.user.removeEmail(String)

// mobile should be as per E.164 standard: https://www.twilio.com/docs/glossary/what-e164
await SuprSend.shared.user.addSMS(String)
await SuprSend.shared.user.removeSMS(String)

// mobile should be as per E.164 standard
await SuprSend.shared.user.addWhatsapp(String)
await SuprSend.shared.user.removeWhatsapp(String)

Update User properties

This is the list of available user update methods:
This method will set users timezone. Timezone value should be in IANA timezone format.
await SuprSend.shared.user.setTimezone(String)
This method will set users preferred language. Language value should be in ISO 639-1 Alpha-2 format.
await SuprSend.shared.user.setPreferredLanguage(String)
Set is used to set the custom user property or properties. If already property is already present value will be replaced.
await SuprSend.shared.user.set(key: String, value: String)
await SuprSend.shared.user.set(properties: [String: Any])
This method will remove user property. To remove channel pass $email, $sms, $whatsapp.
await SuprSend.shared.user.unset(key: String)
await SuprSend.shared.user.unset(keys: [String])
This method will add a value to the list for a given property.
await SuprSend.shared.user.append(key: String, value: String)
await SuprSend.shared.user.append(properties: [String: Any])
This method will remove a value from the list for a given property.
await SuprSend.shared.user.remove(key: String, value: String)
await SuprSend.shared.user.remove(properties: [String: Any])
This method is similar to set method but values once set cannot be updated.
await SuprSend.shared.user.setOnce(key: String, value: String)
await SuprSend.shared.user.setOnce(properties: [String: Any])
Add the given amount to an existing user property. If the user does not already have the associated property, the amount will be added to zero. To reduce a property, provide a negative number as the value.
await SuprSend.shared.user.increment(key: String, value: Int)
await SuprSend.shared.user.increment(properties: [String: Int])
Keys starting with ss_ or $ are reserved and will be ignored.