Push Notification

enum q2_sdk.models.push_notification.AndroidMessagePriority(value)[source]

Valid values are as follows:

NORMAL = <AndroidMessagePriority.NORMAL: 0>
HIGH = <AndroidMessagePriority.HIGH: 1>
enum q2_sdk.models.push_notification.Visibility(value)[source]

Valid values are as follows:

VISIBILITY_UNSPECIFIED = <Visibility.VISIBILITY_UNSPECIFIED: 0>
PRIVATE = <Visibility.PRIVATE: 1>
PUBLIC = <Visibility.PUBLIC: 2>
SECRET = <Visibility.SECRET: 3>
enum q2_sdk.models.push_notification.NotificationPriority(value)[source]

Valid values are as follows:

PRIORITY_UNSPECIFIED = <NotificationPriority.PRIORITY_UNSPECIFIED: 0>
PRIORITY_MIN = <NotificationPriority.PRIORITY_MIN: 1>
PRIORITY_LOW = <NotificationPriority.PRIORITY_LOW: 2>
PRIORITY_DEFAULT = <NotificationPriority.PRIORITY_DEFAULT: 3>
PRIORITY_HIGH = <NotificationPriority.PRIORITY_HIGH: 4>
PRIORITY_MAX = <NotificationPriority.PRIORITY_MAX: 5>
class q2_sdk.models.push_notification.Notification(title=None, body=None, image=None)[source]

Notification(title: str = None, body: str = None, image: str = None)

title: str = None
body: str = None
image: str = None
class q2_sdk.models.push_notification.Color(red=None, green=None, blue=None, alpha=None)[source]

Color(red: float = None, green: float = None, blue: float = None, alpha: float = None)

red: float = None
green: float = None
blue: float = None
alpha: float = None
class q2_sdk.models.push_notification.LightSettings(color=None, lightOnDurationMillis=None, lightOffDurationMillis=None)[source]

LightSettings(color: q2_sdk.models.push_notification.Color = None, lightOnDurationMillis: int = None, lightOffDurationMillis: int = None)

color: Color = None
lightOnDurationMillis: int = None
lightOffDurationMillis: int = None
class q2_sdk.models.push_notification.AndroidNotification(title=None, body=None, icon=None, color=None, sound=None, tag=None, clickAction=None, bodyLocKey=None, bodyLocArgs=<factory>, titleLocKey=None, titleLocArgs=<factory>, channelId=None, ticker=None, sticky=None, eventTime=None, localOnly=None, notificationPriority=None, defaultSound=None, defaultVibrateTimings=None, defaultLightSettings=None, vibrateTimings=<factory>, visibility=None, notificationCount=None, lightSettings=None, image=None)[source]

AndroidNotification(title: str = None, body: str = None, icon: str = None, color: str = None, sound: str = None, tag: str = None, clickAction: str = None, bodyLocKey: str = None, bodyLocArgs: list[str] = <factory>, titleLocKey: str = None, titleLocArgs: list[str] = <factory>, channelId: str = None, ticker: str = None, sticky: bool = None, eventTime: str = None, localOnly: bool = None, notificationPriority: q2_sdk.models.push_notification.NotificationPriority = None, defaultSound: bool = None, defaultVibrateTimings: bool = None, defaultLightSettings: bool = None, vibrateTimings: list[str] = <factory>, visibility: q2_sdk.models.push_notification.Visibility = None, notificationCount: int = None, lightSettings: q2_sdk.models.push_notification.LightSettings = None, image: str = None)

title: str = None
body: str = None
icon: str = None
color: str = None
sound: str = None
tag: str = None
clickAction: str = None
bodyLocKey: str = None
bodyLocArgs: list[str]
titleLocKey: str = None
titleLocArgs: list[str]
channelId: str = None
ticker: str = None
sticky: bool = None
eventTime: str = None
localOnly: bool = None
notificationPriority: NotificationPriority = None
defaultSound: bool = None
defaultVibrateTimings: bool = None
defaultLightSettings: bool = None
vibrateTimings: list[str]
visibility: Visibility = None
notificationCount: int = None
lightSettings: LightSettings = None
image: str = None
class q2_sdk.models.push_notification.AndroidFCMOptions(analyticsLabel=None)[source]

AndroidFCMOptions(analyticsLabel: str = None)

analyticsLabel: str = None
class q2_sdk.models.push_notification.AndroidConfig(collapseKey=None, priority=None, ttl=None, restrictedPackageName=None, data=<factory>, notification=None, fcmOptions=None, directBootOkay=None)[source]

AndroidConfig(collapseKey: str = None, priority: q2_sdk.models.push_notification.AndroidMessagePriority = None, ttl: str = None, restrictedPackageName: str = None, data: dict[str, str] = <factory>, notification: q2_sdk.models.push_notification.AndroidNotification = None, fcmOptions: q2_sdk.models.push_notification.AndroidFCMOptions = None, directBootOkay: bool = None)

collapseKey: str = None
priority: AndroidMessagePriority = None
ttl: str = None
restrictedPackageName: str = None
data: dict[str, str]
notification: AndroidNotification = None
fcmOptions: AndroidFCMOptions = None
directBootOkay: bool = None
class q2_sdk.models.push_notification.WebpushNotificationAction(action=None, title=None, icon=None)[source]

WebpushNotificationAction(action: str = None, title: str = None, icon: str = None)

action: str = None
title: str = None
icon: str = None
class q2_sdk.models.push_notification.WebpushNotification(actions=<factory>, title=None, body=None, icon=None, badge=None, direction=None, data=None, image=None, language=None, renotify=None, requireInteraction=None, silent=None, tag=None, timestampMillis=None, vibrate=<factory>, customData=<factory>)[source]

WebpushNotification(actions: list[q2_sdk.models.push_notification.WebpushNotificationAction] = <factory>, title: str = None, body: str = None, icon: str = None, badge: str = None, direction: str = None, data: str = None, image: str = None, language: str = None, renotify: bool = None, requireInteraction: bool = None, silent: bool = None, tag: str = None, timestampMillis: int = None, vibrate: list[int] = <factory>, customData: dict[str, str] = <factory>)

actions: list[WebpushNotificationAction]
title: str = None
body: str = None
icon: str = None
badge: str = None
direction: str = None
data: str = None
image: str = None
language: str = None
renotify: bool = None
requireInteraction: bool = None
silent: bool = None
tag: str = None
timestampMillis: int = None
vibrate: list[int]
customData: dict[str, str]
class q2_sdk.models.push_notification.WebpushFCMOptions(link=None)[source]

WebpushFCMOptions(link: str = None)

class q2_sdk.models.push_notification.WebpushConfig(headers=<factory>, data=<factory>, notification=None, fcmOptions=None)[source]

WebpushConfig(headers: dict[str, str] = <factory>, data: dict[str, str] = <factory>, notification: q2_sdk.models.push_notification.WebpushNotification = None, fcmOptions: q2_sdk.models.push_notification.WebpushFCMOptions = None)

headers: dict[str, str]
data: dict[str, str]
notification: WebpushNotification = None
fcmOptions: WebpushFCMOptions = None
class q2_sdk.models.push_notification.ApsAlert(title=None, subTitle=None, body=None, locKey=None, locArgs=<factory>, titleLoc=None, titleLocArgs=<factory>, subTitleLoc=None, subTitleLocArgs=<factory>, actionLocKey=None, launchImage=None)[source]

ApsAlert(title: str = None, subTitle: str = None, body: str = None, locKey: str = None, locArgs: list[str] = <factory>, titleLoc: str = None, titleLocArgs: list[str] = <factory>, subTitleLoc: str = None, subTitleLocArgs: list[str] = <factory>, actionLocKey: str = None, launchImage: str = None)

title: str = None
subTitle: str = None
body: str = None
locKey: str = None
locArgs: list[str]
titleLoc: str = None
titleLocArgs: list[str]
subTitleLoc: str = None
subTitleLocArgs: list[str]
actionLocKey: str = None
launchImage: str = None
class q2_sdk.models.push_notification.CriticalSound(critical=None, name=None, volume=None)[source]

CriticalSound(critical: bool = None, name: str = None, volume: float = None)

critical: bool = None
name: str = None
volume: float = None
class q2_sdk.models.push_notification.Aps(alertString=None, alert=None, badge=None, sound=None, criticalSound=None, contentAvailable=None, mutableContent=None, category=None, threadId=None, customData=<factory>)[source]

Aps(alertString: str = None, alert: q2_sdk.models.push_notification.ApsAlert = None, badge: int = None, sound: str = None, criticalSound: q2_sdk.models.push_notification.CriticalSound = None, contentAvailable: bool = None, mutableContent: bool = None, category: str = None, threadId: str = None, customData: dict[str, str] = <factory>)

alertString: str = None
alert: ApsAlert = None
badge: int = None
sound: str = None
criticalSound: CriticalSound = None
contentAvailable: bool = None
mutableContent: bool = None
category: str = None
threadId: str = None
customData: dict[str, str]
class q2_sdk.models.push_notification.APNSPayload(aps=None, customData=<factory>, authenticationCode=None)[source]

APNSPayload(aps: q2_sdk.models.push_notification.Aps = None, customData: dict[str, str] = <factory>, authenticationCode: str = None)

aps: Aps = None
customData: dict[str, str]
authenticationCode: str = None
class q2_sdk.models.push_notification.APNSFCMOptions(analyticsLabel=None, imageUrl=None)[source]

APNSFCMOptions(analyticsLabel: str = None, imageUrl: str = None)

analyticsLabel: str = None
imageUrl: str = None
class q2_sdk.models.push_notification.ApnsConfig(headers=<factory>, payload=None, fcmOptions=None)[source]

ApnsConfig(headers: dict[str, str] = <factory>, payload: q2_sdk.models.push_notification.APNSPayload = None, fcmOptions: q2_sdk.models.push_notification.APNSFCMOptions = None)

headers: dict[str, str]
payload: APNSPayload = None
fcmOptions: APNSFCMOptions = None
class q2_sdk.models.push_notification.FcmOptions(analyticsLabel=None)[source]

FcmOptions(analyticsLabel: str = None)

analyticsLabel: str = None
class q2_sdk.models.push_notification.Message(name=None, data=<factory>, notification=None, android=None, webpush=None, apns=None, fcmOptions=None)[source]

Message(name: str = None, data: dict[str, str] = <factory>, notification: q2_sdk.models.push_notification.Notification = None, android: q2_sdk.models.push_notification.AndroidConfig = None, webpush: q2_sdk.models.push_notification.WebpushConfig = None, apns: q2_sdk.models.push_notification.ApnsConfig = None, fcmOptions: q2_sdk.models.push_notification.FcmOptions = None)

name: str = None
data: dict[str, str]
notification: Notification = None
android: AndroidConfig = None
webpush: WebpushConfig = None
apns: ApnsConfig = None
fcmOptions: FcmOptions = None
class q2_sdk.models.push_notification.SendRequest(validateOnly=None, message=None)[source]

SendRequest(validateOnly: bool = None, message: q2_sdk.models.push_notification.Message = None)

validateOnly: bool = None
message: Message = None
class q2_sdk.models.push_notification.NotificationRequest(id, create_date, country_id='USA', retry_count=0, id_only=False)[source]

NotificationRequest(id: int, create_date: str, country_id: str = ‘USA’, retry_count: int = 0, id_only: bool = False)

id: int
create_date: str
country_id: str = 'USA'
retry_count: int = 0
id_only: bool = False
class q2_sdk.models.push_notification.PushRequestV2(notification, request)[source]

PushRequestV2(notification: q2_sdk.models.push_notification.NotificationRequest, request: q2_sdk.models.push_notification.SendRequest)

notification: NotificationRequest
request: SendRequest
class q2_sdk.models.push_notification.SendResponseV2(success=False, error_message='', data=<factory>)[source]

SendResponseV2(success: bool = False, error_message: str = ‘’, data: dict = <factory>)

success: bool = False
error_message: str = ''
data: dict
class q2_sdk.models.push_notification.PushNotificationParams(subject, target_address, target_user_id, device_nickname='', country_code='USA', envstack='', environment='')[source]

PushNotificationParams(subject: str, target_address: str, target_user_id: int, device_nickname: str = ‘’, country_code: str = ‘USA’, envstack: str = ‘’, environment: Union[q2_sdk.core.default_settings.EnvLevel, str] = ‘’)

subject: str

the target address value is no longer in use. Passing in an empty string should suffice.

Type:

Note

target_address: str
target_user_id: int
device_nickname: str = ''
country_code: str = 'USA'
envstack: str = ''
environment: Union[EnvLevel, str] = ''
class q2_sdk.models.push_notification.PushNotification(logger, hq_credentials, params, cache=None)[source]

Provides ability to send rich (enhanced) push notifications to end users through the Firebase Cloud Messaging (FCM) Service. Push notifications are supported on HQ version 4.5.0.6065 and above. For additional information on the payload, please visit the Firebase API Documentation. Note, sending rich data such as images, sounds, deep linking, would require MSDK module integration. Please visit the MSDK Documentation for more details.

MIN_HQ_BUILD = '6065'
async send_by_device_nickname(send_request)[source]

Send notification by device nickname. Converts provided request into the q2msg PushRequestV2 protobuf message. Encrypts the message and sends the request.

Return type:

SendResponseV2

async send_by_id(send_request)[source]

Send notification by user ID. Will send notification to all devices tied to the user. Converts provided request into the q2msg PushRequestV2 protobuf message. Encrypts the message and sends the request.

Return type:

list[SendResponseV2]

async send(send_request)[source]

This function has been deprecated. Use send_by_device_nickname (or send_by_id depending on your needs) instead.

Return type:

SendResponseV2