import { RpcMethod, Duration } from './commonTypes'; import { FilterExpression as pushwoosh_objects_filters_v1_FilterExpression } from './pushwoosh_objects_filters_v1'; export type MessagingService_Notify = RpcMethod; export type MessagingService_NotifyBulk = RpcMethod; export interface MessagingService { /** Notify creates a new message. Can be targeted to a segment or a list of users. */ Notify: MessagingService_Notify; /** NotifyBulk creates several messages. */ NotifyBulk: MessagingService_NotifyBulk; /** NotifyStream is async version of Notify. */ NotifyStream(request: NotifyStreamRequest, options?: { signal?: AbortSignal; }): Promise>; } export type NotifyRequest_kind_segment = { type: 'segment'; data: NotifySegment; }; export type NotifyRequest_kind_transactional = { type: 'transactional'; data: NotifyTransactional; }; export type NotifyRequest_kind = NotifyRequest_kind_segment | NotifyRequest_kind_transactional; export type NotifyRequest = { kind: NotifyRequest_kind; }; export type NotifyResponse = { result: NotifyResult; }; export type NotifyBulkRequest = { requests?: NotifyRequest[]; }; export type NotifyBulkResponse = { result: NotifyResult[]; }; export type NotifyStreamRequest = { request?: NotifyRequest; }; export type NotifyStreamResponse = {}; export type NotifyResult = { messageCode: string; unknownIdentifiers: string[]; }; export type MessageType = 'MESSAGE_TYPE_UNSPECIFIED' | 'MESSAGE_TYPE_MARKETING' | 'MESSAGE_TYPE_TRANSACTIONAL'; export type Platform = 'UNKNOWN' | 'IOS' | 'ANDROID' | 'OSX' | 'WINDOWS' | 'AMAZON' | 'SAFARI' | 'CHROME' | 'FIREFOX' | 'IE' | 'EMAIL' | 'BAIDU_ANDROID' | 'HUAWEI_ANDROID' | 'SMS' | 'WEB' | 'WHATS_APP' | 'LINE' | 'KAKAO' | 'TELEGRAM'; export type NotifySegment_target_code = { type: 'code'; data: string; }; export type NotifySegment_target_expression = { type: 'expression'; data: string; }; export type NotifySegment_target_filterExpression = { type: 'filterExpression'; data: pushwoosh_objects_filters_v1_FilterExpression; }; export type NotifySegment_target = NotifySegment_target_code | NotifySegment_target_expression | NotifySegment_target_filterExpression; export type NotifySegment_messagePayload_payload = { type: 'payload'; data: Payload; }; export type NotifySegment_messagePayload_emailPayload = { type: 'emailPayload'; data: EmailPayload; }; export type NotifySegment_messagePayload = NotifySegment_messagePayload_payload | NotifySegment_messagePayload_emailPayload; /** * NotifySegment defines a request to send a message to a segment of users. * Segment can be defined either by a segment code or by a seglang expression. */ export type NotifySegment = { /** Message schedule. */ schedule: Schedule; /** Application code to get hwids, users and push tokens from. */ application: string; /** List of platform. */ platforms: Platform[]; /** Message frequency capping. */ frequencyCapping: FrequencyCapping; /** Campaign code */ campaign: string; sendRate: SendRate; metaData: object; dynamicContentPlaceholders: Record; /** * Message type: marketing or transactional. * Used to control behavior like control group filtering. */ messageType: MessageType; target: NotifySegment_target; messagePayload: NotifySegment_messagePayload; }; export type NotifyTransactional_HwidsList = { list: string[]; }; export type NotifyTransactional_UsersList = { list: string[]; }; export type NotifyTransactional_PushTokensList = { list: string[]; }; export type NotifyTransactional_target_testDevices = { type: 'testDevices'; data: boolean; }; export type NotifyTransactional_target_hwids = { type: 'hwids'; data: NotifyTransactional_HwidsList; }; export type NotifyTransactional_target_users = { type: 'users'; data: NotifyTransactional_UsersList; }; export type NotifyTransactional_target_pushTokens = { type: 'pushTokens'; data: NotifyTransactional_PushTokensList; }; export type NotifyTransactional_target = NotifyTransactional_target_testDevices | NotifyTransactional_target_hwids | NotifyTransactional_target_users | NotifyTransactional_target_pushTokens; export type NotifyTransactional_messagePayload_payload = { type: 'payload'; data: Payload; }; export type NotifyTransactional_messagePayload_emailPayload = { type: 'emailPayload'; data: EmailPayload; }; export type NotifyTransactional_messagePayload = NotifyTransactional_messagePayload_payload | NotifyTransactional_messagePayload_emailPayload; export type NotifyTransactional = { /** Message schedule. */ schedule: Schedule; /** Application code to get hwids, users and push tokens from. */ application: string; /** List of platform. */ platforms: Platform[]; /** * Flag indicating whether to return the list of unknown identifiers. * If true, the response will include the 'unknown_identifiers' field */ returnUnknownIdentifiers: boolean; /** Message frequency capping. */ frequencyCapping: FrequencyCapping; /** Campaign code */ campaign: string; sendRate: SendRate; metaData: object; dynamicContentPlaceholders: Record; /** * Message type: marketing or transactional. * Used to control behavior like control group filtering. */ messageType: MessageType; /** * Point-level TTL. When set, it overrides per-platform TTL * values and the preset-level TTL, and is applied uniformly across every * push platform (iOS, Android, Huawei, Baidu, Chrome, macOS, Safari, Amazon, * Windows). */ ttl: Duration; target: NotifyTransactional_target; messagePayload: NotifyTransactional_messagePayload; }; export type Schedule_PastTimezonesBehaviour = 'PAST_TIMEZONES_BEHAVIOUR_DEFAULT' /** users whose timezone is already in the past will receive the message immediately. */ | 'PAST_TIMEZONES_BEHAVIOUR_SEND_IMMEDIATELY' /** users whose timezone is already in the past will not receive the message. */ | 'PAST_TIMEZONES_BEHAVIOUR_DO_NOT_SEND' /** users whose timezone is already in the past will receive the message on the next day. */ | 'PAST_TIMEZONES_BEHAVIOUR_NEXT_DAY'; export type Schedule_sendDate_at = { type: 'at'; data: Date; }; export type Schedule_sendDate_after = { type: 'after'; data: Duration; }; export type Schedule_sendDate = Schedule_sendDate_at | Schedule_sendDate_after; /** Message schedule. */ export type Schedule = { /** Whether to send the message according to user's timezone. */ followUserTimezone: boolean; /** What to do with past timezones. */ pastTimezonesBehaviour: Schedule_PastTimezonesBehaviour; sendDate: Schedule_sendDate; }; /** Message frequency capping. */ export type FrequencyCapping = { days: number; count: number; exclude: boolean; avoid: boolean; }; export type SendRate = { value: number; bucket: string; avoid: boolean; }; export type DeliveryPriority = 'NORMAL' | 'HIGH'; export type NotificationPriority = 'PRIORITY_UNSPECIFIED' | 'PRIORITY_MIN' | 'PRIORITY_LOW' | 'PRIORITY_DEFAULT' | 'PRIORITY_HIGH' | 'PRIORITY_MAX'; export type LiveActivity = { event: string; dismissalDate: number; contentState: object; }; export type Link_Shortener = 'NONE' | 'BITLY'; export type Link = { url: string; shortener: Link_Shortener; }; export type RichMedia_kind_code = { type: 'code'; data: string; }; export type RichMedia_kind_url = { type: 'url'; data: string; }; export type RichMedia_kind = RichMedia_kind_code | RichMedia_kind_url; export type RichMedia = { kind: RichMedia_kind; }; export type DeepLink = { code: string; params: Record; }; export type OpenAction_kind_richMedia = { type: 'richMedia'; data: RichMedia; }; export type OpenAction_kind_deepLink = { type: 'deepLink'; data: DeepLink; }; export type OpenAction_kind_link = { type: 'link'; data: Link; }; export type OpenAction_kind = OpenAction_kind_richMedia | OpenAction_kind_deepLink | OpenAction_kind_link; export type OpenAction = { kind: OpenAction_kind; }; export type Inbox = { imageUrl: string; expirationDate: Date; }; export type Content_PlatformPropertiesIos = { title: string; subtitle: string; body: string; timeToLive: Duration; isCritical: boolean; attachment: string; sound: string; threadId: string; badges: string; trimContent: boolean; categoryId: string; soundEnabled: boolean; interruptionLevel: string; rootParams: object; liveActivity: LiveActivity; collapseId: string; inbox: Inbox; }; export type Content_PlatformPropertiesAndroid = { title: string; body: string; timeToLive: Duration; icon: string; banner: string; deliveryPriority: DeliveryPriority; vibration: boolean; badges: string; sound: string; ledColor: string; soundEnabled: boolean; iconBackgroundColor: string; showOnLockscreen: boolean; rootParams: object; customIcon: string; priority: NotificationPriority; groupId: string; collapseKey: string; inbox: Inbox; }; export type Content_PlatformPropertiesChrome = { title: string; body: string; timeToLive: Duration; icon: string; image: string; rootParams: object; duration: Duration; buttonText1: string; buttonUrl1: string; buttonText2: string; buttonUrl2: string; inbox: Inbox; }; export type Content_PlatformPropertiesFirefox = { title: string; body: string; icon: string; rootParams: object; inbox: Inbox; }; export type Content_PlatformPropertiesSafari = { title: string; body: string; timeToLive: Duration; action: string; urlArguments: string[]; inbox: Inbox; }; export type Content_PlatformPropertiesMacOS = { title: string; body: string; timeToLive: Duration; action: string; sound: string; soundEnabled: boolean; badges: string; rootParams: object; inbox: Inbox; subtitle: string; }; export type Content_PlatformPropertiesAmazon = { title: string; body: string; timeToLive: Duration; banner: string; sound: string; soundEnabled: boolean; rootParams: object; icon: string; customIcon: string; priority: NotificationPriority; inbox: Inbox; }; export type Content_PlatformPropertiesBaiduAndroid = { title: string; body: string; timeToLive: Duration; icon: string; banner: string; deliveryPriority: DeliveryPriority; vibration: boolean; badges: string; sound: string; ledColor: string; soundEnabled: boolean; iconBackgroundColor: string; showOnLockscreen: boolean; rootParams: object; customIcon: string; priority: NotificationPriority; groupId: string; inbox: Inbox; }; export type Content_PlatformPropertiesHuaweiAndroid = { title: string; body: string; timeToLive: Duration; icon: string; banner: string; deliveryPriority: DeliveryPriority; vibration: boolean; badges: string; sound: string; ledColor: string; soundEnabled: boolean; iconBackgroundColor: string; showOnLockscreen: boolean; rootParams: object; customIcon: string; priority: NotificationPriority; groupId: string; inbox: Inbox; }; export type Content_PlatformPropertiesIE = { title: string; iconBadge: string; body: string; inbox: Inbox; }; export type Content_PlatformPropertiesWindows_Raw = { content: string; }; export type Content_PlatformPropertiesWindows_Template = { title: string; subtitle: string; body: string; imageUrl: string; }; export type Content_PlatformPropertiesWindows_Type = 'TILE' | 'TOAST' | 'BADGE'; export type Content_PlatformPropertiesWindows_content_raw = { type: 'raw'; data: Content_PlatformPropertiesWindows_Raw; }; export type Content_PlatformPropertiesWindows_content_template = { type: 'template'; data: Content_PlatformPropertiesWindows_Template; }; export type Content_PlatformPropertiesWindows_content = Content_PlatformPropertiesWindows_content_raw | Content_PlatformPropertiesWindows_content_template; export type Content_PlatformPropertiesWindows = { type: Content_PlatformPropertiesWindows_Type; tag: string; cache: boolean; timeToLive: Duration; content: Content_PlatformPropertiesWindows_content; }; export type Content_PlatformPropertiesSMS = {}; export type Content_PlatformPropertiesTelegram = { body: string; contentVariables: string; }; export type Content_PlatformPropertiesKakao = { content: string; template: string; contentVariables: string; }; export type Content_PlatformPropertiesLine = { content: string; template: string; }; export type Content_PlatformPropertiesWhatsApp = { /** * Free-form text body. Meta only accepts it inside the 24-hour customer * service window (opened when the end user sent an inbound message). * Exactly one of `content` or `content_id` must be set. */ content: string; /** * Name of a pre-approved Meta template (e.g. "hello_world"). Required for * outbound initiation or any message outside the 24h window; dynamic data * goes through {content,header,button_url}_variables. * Exactly one of `content` or `content_id` must be set. */ contentId: string; /** * Template locale that must exactly match the one approved in Meta * (e.g. "en_US", "en_GB"). Only meaningful with `content_id`. */ language: string; /** JSON string, map of template body placeholders (e.g. {"1":"John"}). */ contentVariables: string; /** * JSON string, map of button-URL placeholders keyed by button index * (e.g. {"0":"https://..."}). */ buttonUrlVariables: string; /** * JSON string, map of header placeholders keyed by type * (e.g. {"image":"https://..."}). */ headerVariables: string; }; export type Content = { ios: Content_PlatformPropertiesIos; android: Content_PlatformPropertiesAndroid; macOs: Content_PlatformPropertiesMacOS; amazon: Content_PlatformPropertiesAmazon; safari: Content_PlatformPropertiesSafari; chrome: Content_PlatformPropertiesChrome; firefox: Content_PlatformPropertiesFirefox; baiduAndroid: Content_PlatformPropertiesBaiduAndroid; huaweiAndroid: Content_PlatformPropertiesHuaweiAndroid; ie: Content_PlatformPropertiesIE; windows: Content_PlatformPropertiesWindows; telegram: Content_PlatformPropertiesTelegram; kakao: Content_PlatformPropertiesKakao; line: Content_PlatformPropertiesLine; whatsapp: Content_PlatformPropertiesWhatsApp; }; export type LocalizedContent = { localizedContent: Record; }; export type Payload_kind_content = { type: 'content'; data: LocalizedContent; }; export type Payload_kind_silent = { type: 'silent'; data: boolean; }; export type Payload_kind = Payload_kind_content | Payload_kind_silent; export type Payload = { preset: string; customData: object; openAction: OpenAction; openActions: Record; voipPush: boolean; kind: Payload_kind; }; /** Email attachments. */ export type EmailPayload_Attachment = { /** File name of the attachment. */ name: string; /** Base64-encoded content of the attachment file. */ content: string; }; /** Email address descriptor (name and email). */ export type EmailPayload_Address = { name: string; email: string; }; export type EmailPayload = { /** Subject line for the email. Per-locale values */ subject: Record; /** Email body HTML content. Use LocalizedContent to provide per-locale values. */ body: string; attachments: EmailPayload_Attachment[]; /** Custom URL for the List-Unsubscribe header. */ listUnsubscribe: string; /** Override default "From" configured in application properties. */ from: EmailPayload_Address; /** Override default "Reply-To" configured in application properties. */ replyTo: EmailPayload_Address; /** Email template code to use for this email, must reference an existing Email Template. */ emailTemplate: string; };