User#
flet_onesignal.user.OneSignalUser
#
OneSignal User namespace.
Provides methods for managing user identity, tags, aliases, email, SMS, and language.
Functions#
add_alias
async
#
Add a single alias to the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The alias label. |
required |
id
|
str
|
The alias ID. |
required |
add_aliases
async
#
Add multiple aliases to the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aliases
|
dict[str, str]
|
A dictionary of alias label-ID pairs. |
required |
add_email
async
#
Add an email address to the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
The email address to add. |
required |
add_sms
async
#
Add an SMS number to the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phone
|
str
|
The phone number to add (E.164 format recommended). |
required |
add_tag
async
#
Add a single tag to the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The tag key. |
required |
value
|
str
|
The tag value. |
required |
add_tags
async
#
Add multiple tags to the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tags
|
dict[str, str]
|
A dictionary of tag key-value pairs. |
required |
get_external_id
async
#
Get the external ID for the current user.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The external ID, or None if not set. |
get_onesignal_id
async
#
Get the OneSignal ID for the current user.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The OneSignal ID, or None if not available. |
get_push_subscription_id
async
#
Get the push subscription ID.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The push subscription ID, or None if not available. |
get_push_subscription_token
async
#
Get the push subscription token.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
The push subscription token, or None if not available. |
get_tags
async
#
Get all tags for the current user.
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
A dictionary of tag key-value pairs. |
is_push_opted_in
async
#
Check if the user is opted in to push notifications.
Returns:
| Type | Description |
|---|---|
bool
|
True if opted in, False otherwise. |
opt_in_push
async
#
Opt the user in to push notifications.
Call this to receive push notifications on the device or to resume receiving notifications after calling opt_out_push().
opt_out_push
async
#
Opt the user out of push notifications.
The user will stop receiving push notifications on the current device.
remove_alias
async
#
Remove a single alias from the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The alias label to remove. |
required |
remove_aliases
async
#
Remove multiple aliases from the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
labels
|
list[str]
|
A list of alias labels to remove. |
required |
remove_email
async
#
Remove an email address from the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
The email address to remove. |
required |
remove_sms
async
#
Remove an SMS number from the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phone
|
str
|
The phone number to remove. |
required |
remove_tag
async
#
Remove a single tag from the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The tag key to remove. |
required |
remove_tags
async
#
Remove multiple tags from the current user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
list[str]
|
A list of tag keys to remove. |
required |
set_language
async
#
Set the language for the current user.
This also applies to email and SMS subscriptions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
language_code
|
str
|
The ISO 639-1 language code (e.g., "en", "pt", "es"). |
required |