import { RpcMethod } from './commonTypes'; export type IntegrationsService_ListIntegrationsConfiguration = RpcMethod; export type IntegrationsService_GetWebhookConfiguration = RpcMethod; export type IntegrationsService_CreateWebhookConfiguration = RpcMethod; export type IntegrationsService_GetSegmentConfiguration = RpcMethod; export type IntegrationsService_CreateSegmentConfiguration = RpcMethod; export type IntegrationsService_GetPianoConfiguration = RpcMethod; export type IntegrationsService_CreatePianoConfiguration = RpcMethod; export type IntegrationsService_ImportSegmentPiano = RpcMethod; export type IntegrationsService_GetHubspotConfiguration = RpcMethod; export type IntegrationsService_GetShopifyConfiguration = RpcMethod; export type IntegrationsService_GetStripeAuthURL = RpcMethod; export type IntegrationsService_HandleStripeAuthCallback = RpcMethod; export type IntegrationsService_GetStripeConfiguration = RpcMethod; export type IntegrationsService_DeleteStripeConfiguration = RpcMethod; export type IntegrationsService_GetMetaAuthURL = RpcMethod; export type IntegrationsService_HandleMetaAuthCallback = RpcMethod; export type IntegrationsService_GetMetaConfiguration = RpcMethod; export type IntegrationsService_DeleteMetaConfiguration = RpcMethod; export type IntegrationsService_DisconnectMetaAdAccounts = RpcMethod; export type IntegrationsService_RefreshMetaConnection = RpcMethod; export type IntegrationsService_ListMetaAdAccounts = RpcMethod; export type IntegrationsService_ConnectMetaAdAccounts = RpcMethod; export type IntegrationsService_SetMetaTagMapping = RpcMethod; export type IntegrationsService_GetGoogleBQConfiguration = RpcMethod; export type IntegrationsService_CreateGoogleBQConfiguration = RpcMethod; export type IntegrationsService_DeleteGoogleBQConfiguration = RpcMethod; export type IntegrationsService_TestGoogleBQConnection = RpcMethod; export type IntegrationsService_ListGoogleBQDatasets = RpcMethod; export type IntegrationsService_ListGoogleBQTables = RpcMethod; export interface IntegrationsService { /** Lists which output integrations (webhook, Segment, Piano, HubSpot, Shopify, Stripe, Meta, Google BigQuery, inbound webhook) are configured for an application code XXXXX-XXXXX. Use for an at-a-glance configured/not-configured overview before fetching a specific integration's configuration. */ ListIntegrationsConfiguration: IntegrationsService_ListIntegrationsConfiguration; /** * webhook * Returns the outbound webhook integration configuration for an application code XXXXX-XXXXX: target URL, auth header, subscribed and available events, transport and filters. Use to inspect the outbound webhook that forwards PW events to a third-party endpoint (not the inbound webhook). */ GetWebhookConfiguration: IntegrationsService_GetWebhookConfiguration; /** Creates or overwrites the outbound webhook integration for an application code XXXXX-XXXXX (URL, auth header, event subscriptions, transport, filters). Use to point PW event delivery at a third-party endpoint; re-sending replaces the stored configuration. */ CreateWebhookConfiguration: IntegrationsService_CreateWebhookConfiguration; /** * segment * Returns the Twilio Segment integration configuration for an application code XXXXX-XXXXX: write key plus subscribed and available events. Use to inspect which PW events are forwarded to Segment. */ GetSegmentConfiguration: IntegrationsService_GetSegmentConfiguration; /** Creates or overwrites the Twilio Segment integration for an application code XXXXX-XXXXX (write key and subscribed events). Use to set up or update event forwarding to Segment; re-sending replaces the stored configuration. */ CreateSegmentConfiguration: IntegrationsService_CreateSegmentConfiguration; /** * piano * Returns the Piano integration configuration for an application code XXXXX-XXXXX: collection domain, site id, API key, subscribed/available events and unique-event grouping settings. Use to inspect the Piano analytics connection. */ GetPianoConfiguration: IntegrationsService_GetPianoConfiguration; /** Creates or overwrites the Piano integration for an application code XXXXX-XXXXX (collection domain, site id, API key, events and unique-event grouping). Use to set up or update the Piano connection; re-sending replaces the stored configuration. */ CreatePianoConfiguration: IntegrationsService_CreatePianoConfiguration; /** Imports a Piano audience segment into Pushwoosh for an application code XXXXX-XXXXX by its Piano segment key. Reaches Piano to pull the segment; use only for Piano-connected applications. */ ImportSegmentPiano: IntegrationsService_ImportSegmentPiano; /** * hubspot * Returns the HubSpot integration OAuth configuration for an application code XXXXX-XXXXX: access token, refresh token, connected user id and last-updated time. Use to inspect the HubSpot connection status. */ GetHubspotConfiguration: IntegrationsService_GetHubspotConfiguration; /** * shopify * Returns the Shopify integration configuration for an application code XXXXX-XXXXX: shop domain, device API key and whether it is the main application. Use to inspect the Shopify connection. */ GetShopifyConfiguration: IntegrationsService_GetShopifyConfiguration; /** * stripe * Builds the Stripe OAuth authorization URL to start connecting a Stripe account, given a redirect URI. Use to begin the Stripe connect flow; the user visits the URL and returns via connect_stripe_integration. */ GetStripeAuthURL: IntegrationsService_GetStripeAuthURL; /** Completes the Stripe OAuth flow by exchanging the returned authorization code for tokens and storing the Stripe connection for an application code XXXXX-XXXXX. Call after the user finishes the get_stripe_auth_url redirect; the code is single-use. */ HandleStripeAuthCallback: IntegrationsService_HandleStripeAuthCallback; /** Returns the connected Stripe account for the current account: business name and email. Use to check whether Stripe is connected and to which account. */ GetStripeConfiguration: IntegrationsService_GetStripeConfiguration; /** Removes the Stripe integration connection for the current account. Use to disconnect Stripe; the stored tokens are revoked and cannot be restored without reconnecting. */ DeleteStripeConfiguration: IntegrationsService_DeleteStripeConfiguration; /** * meta * Builds the Meta (Facebook) OAuth authorization URL to start connecting a Meta account, given a redirect URI. Use to begin the Meta connect flow; the user returns via connect_meta_integration. */ GetMetaAuthURL: IntegrationsService_GetMetaAuthURL; /** Completes the Meta OAuth flow by exchanging the authorization code for tokens and storing the Meta connection for an application code XXXXX-XXXXX. Call after the get_meta_auth_url redirect; the code is single-use. */ HandleMetaAuthCallback: IntegrationsService_HandleMetaAuthCallback; /** Returns the Meta integration configuration for the current account: connected ad accounts with status, token validity and the audience tag mapping. Use to inspect the current Meta connection state. */ GetMetaConfiguration: IntegrationsService_GetMetaConfiguration; /** Removes the entire Meta integration connection for the current account, including all connected ad accounts and tag mapping. Use to fully disconnect Meta; not recoverable without reconnecting. */ DeleteMetaConfiguration: IntegrationsService_DeleteMetaConfiguration; /** Disconnects the given Meta ad accounts by id while keeping the overall Meta connection. Use to remove specific ad accounts; to drop the whole connection use delete_meta_integration. */ DisconnectMetaAdAccounts: IntegrationsService_DisconnectMetaAdAccounts; /** Refreshes the Meta connection for a single ad account id, re-validating its access token with Meta. Use when an ad account shows an invalid or expired token. */ RefreshMetaConnection: IntegrationsService_RefreshMetaConnection; /** Lists the Meta ad accounts available to the connected Meta account, each with connection status and business info. Use to discover ad accounts before connecting them with connect_meta_ad_accounts. */ ListMetaAdAccounts: IntegrationsService_ListMetaAdAccounts; /** Connects the given Meta ad accounts by id, returning the connected ids and any that require accepting Meta terms of service first. Use after list_meta_ad_accounts to activate selected ad accounts. */ ConnectMetaAdAccounts: IntegrationsService_ConnectMetaAdAccounts; /** Overwrites the mapping between Pushwoosh tags and Meta custom-audience fields for the current account. Use to define which PW tags sync to Meta audiences; replaces the entire mapping. */ SetMetaTagMapping: IntegrationsService_SetMetaTagMapping; /** * google_bq * Returns the Google BigQuery integration configuration for an application code XXXXX-XXXXX: GCP project, dataset, region, service-account email and export settings (enabled, event types, table). Use to inspect the BigQuery export setup. */ GetGoogleBQConfiguration: IntegrationsService_GetGoogleBQConfiguration; /** Creates or overwrites the Google BigQuery integration for an application code XXXXX-XXXXX (connection credentials and event-export settings). Use to set up or update BigQuery export; re-sending replaces the stored configuration. */ CreateGoogleBQConfiguration: IntegrationsService_CreateGoogleBQConfiguration; /** Removes the Google BigQuery integration for an application code XXXXX-XXXXX. Use to disconnect BigQuery export; the stored service-account credentials are deleted. */ DeleteGoogleBQConfiguration: IntegrationsService_DeleteGoogleBQConfiguration; /** Validates Google BigQuery credentials for an application code XXXXX-XXXXX by connecting to BigQuery, returning ok plus an error code/message. Pass inline credentials to test before saving, or leave them empty to validate the stored configuration. */ TestGoogleBQConnection: IntegrationsService_TestGoogleBQConnection; /** * POST + body: '*' is deliberate — the request carries the Service Account * JSON when listing pre-save, and we don't want a PEM key on the URL (access * logs, browser history, proxy logs, URL length limits). * Lists Google BigQuery datasets for an application code XXXXX-XXXXX, optionally using inline credentials (both project id and service-account JSON required) instead of the stored ones. Use to populate a destination-dataset picker before saving the integration. */ ListGoogleBQDatasets: IntegrationsService_ListGoogleBQDatasets; /** Lists tables and views in a Google BigQuery dataset for an application code XXXXX-XXXXX. Use after list_google_bq_datasets to pick a destination table for export. */ ListGoogleBQTables: IntegrationsService_ListGoogleBQTables; } /** Integration contains all available integration for clients (to update props) */ export type Integration = 'UNKNOWN' | 'SEGMENT' | 'PIANO' | 'WEBHOOK' | 'HUBSPOT' | 'SHOPIFY' | 'STRIPE' | 'META' | 'INBOUND_WEBHOOK' | 'GOOGLE_BQ'; export type ImportSegmentPianoRequest = { /** application code */ application?: string; /** client segment name from piano */ segmentKey?: string; }; export type ImportSegmentPianoResponse = {}; export type ListIntegrationsConfigurationRequest = { /** application code */ application?: string; }; export type ListIntegrationsConfigurationResponse_Configuration = { integration: Integration; configured: boolean; }; export type ListIntegrationsConfigurationResponse = { configurations: ListIntegrationsConfigurationResponse_Configuration[]; }; export type WebhookIntegrationTransportType = 'NONE' | 'GRPC' | 'HTTP'; export type Filters_MessagesFilter = { codes: string[]; }; export type Filters_PlatformsFilter = { platforms: number[]; }; export type Filters_CampaignsFilter = { codes: string[]; }; export type Filters_LiveActivityFilter = { enabled: boolean; }; export type Filters = { messages: Filters_MessagesFilter; platforms: Filters_PlatformsFilter; campaigns: Filters_CampaignsFilter; liveActivity: Filters_LiveActivityFilter; }; export type GetWebhookConfigurationRequest = { application?: string; }; export type GetWebhookConfigurationResponse = { /** webhook url */ url: string; /** authorization header */ auth: string; /** events that picked by client to receive */ events: string[]; filters: Filters; transport: WebhookIntegrationTransportType; /** events that available to process */ availableEvents: string[]; }; export type CreateWebhookConfigurationRequest = { application?: string; /** webhook url */ url?: string; /** authorization header */ auth?: string; /** events names that picked by client to receive */ events?: string[]; filters?: Filters; transport?: WebhookIntegrationTransportType; }; export type CreateWebhookConfigurationResponse = {}; export type GetSegmentConfigurationRequest = { application?: string; }; export type GetSegmentConfigurationResponse = { writeKey: string; events: string[]; availableEvents: string[]; }; export type CreateSegmentConfigurationRequest = { application?: string; writeKey?: string; events?: string[]; }; export type CreateSegmentConfigurationResponse = {}; export type GetPianoConfigurationRequest = { application?: string; }; export type GetPianoConfigurationResponse = { collectionDomain: string; siteId: string; apiKey: string; /** event names that picked by client to receive */ events: string[]; /** if true - unique grouping feature turned on, false otherwise */ uniqueEventsEnabled: boolean; /** event names that picked by client for unique grouping feature */ uniqueEvents: string[]; /** time frame for event grouping */ uniqueEventsTimeframe: number; /** event names that available to process */ availableEvents: string[]; }; export type CreatePianoConfigurationRequest = { application?: string; collectionDomain?: string; siteId?: string; apiKey?: string; /** event names that picked by client to receive */ events?: string[]; /** if true - unique grouping feature turned on, false otherwise */ uniqueEventsEnabled?: boolean; /** event names that picked by client for unique grouping feature */ uniqueEvents?: string[]; /** time frame for event grouping */ uniqueEventsTimeframe?: number; }; export type CreatePianoConfigurationResponse = {}; export type GetHubspotConfigurationRequest = { application?: string; }; export type GetHubspotConfigurationResponse = { /** access token */ accessToken: string; /** refresh token */ refreshToken: string; /** updated at */ updated: string; /** user id */ userId: string; }; export type GetShopifyConfigurationRequest = { application?: string; }; export type GetShopifyConfigurationResponse = { /** shop domain */ shopDomain: string; /** device api key */ deviceApiKey: string; /** true if main application, false otherwise */ mainApplication: boolean; }; /** Stripe messages */ export type GetStripeAuthURLRequest = { /** URI Stripe redirects back to after authorization */ redirectUri?: string; }; export type GetStripeAuthURLResponse = { authUrl: string; }; export type HandleStripeAuthCallbackRequest = { /** single-use OAuth authorization code returned by Stripe */ code?: string; /** application code (format XXXXX-XXXXX) */ applicationCode?: string; }; export type HandleStripeAuthCallbackResponse = {}; export type GetStripeConfigurationRequest = {}; export type GetStripeConfigurationResponse = { email: string; businessName: string; }; export type DeleteStripeConfigurationRequest = {}; export type DeleteStripeConfigurationResponse = {}; /** Meta messages */ export type GetMetaAuthURLRequest = { /** URI Meta redirects back to after authorization */ redirectUri?: string; }; export type GetMetaAuthURLResponse = { authUrl: string; }; export type HandleMetaAuthCallbackRequest = { /** single-use OAuth authorization code returned by Meta */ code?: string; /** redirect URI used to obtain the code (must match) */ redirectUri?: string; /** application code (format XXXXX-XXXXX) */ applicationCode?: string; }; export type HandleMetaAuthCallbackResponse = {}; export type GetMetaConfigurationRequest = {}; export type MetaAdAccountStatus = 'META_AD_ACCOUNT_STATUS_UNSPECIFIED' | 'META_AD_ACCOUNT_STATUS_CONNECTED' | 'META_AD_ACCOUNT_STATUS_DISCONNECTED' | 'META_AD_ACCOUNT_STATUS_PENDING'; export type MetaBusinessInfo = { id: string; name: string; }; export type GetMetaConfigurationResponse_MetaAdAccount = { id: string; name: string; status: MetaAdAccountStatus; business: MetaBusinessInfo; }; export type GetMetaConfigurationResponse = { adAccounts: GetMetaConfigurationResponse_MetaAdAccount[]; tokenValid: boolean; tagMapping: Record; }; export type DeleteMetaConfigurationRequest = {}; export type DeleteMetaConfigurationResponse = {}; export type DisconnectMetaAdAccountsRequest = { /** Meta ad account ids to disconnect */ adAccountIds?: string[]; }; export type DisconnectMetaAdAccountsResponse = {}; export type RefreshMetaConnectionRequest = { /** Meta ad account id whose connection to refresh */ adAccountId?: string; }; export type RefreshMetaConnectionResponse = {}; export type ListMetaAdAccountsRequest = {}; export type ListMetaAdAccountsResponse_MetaAdAccount = { id: string; name: string; status: MetaAdAccountStatus; business: MetaBusinessInfo; }; export type ListMetaAdAccountsResponse = { adAccounts: ListMetaAdAccountsResponse_MetaAdAccount[]; }; export type ConnectMetaAdAccountsRequest = { /** Meta ad account ids to connect */ adAccountIds?: string[]; }; export type ConnectMetaAdAccountsResponse_TosRequired = { adAccountId: string; tosUrl: string; }; export type ConnectMetaAdAccountsResponse = { connectedIds: string[]; tosRequired: ConnectMetaAdAccountsResponse_TosRequired[]; }; export type SetMetaTagMappingRequest = { /** Pushwoosh tag name -> Meta custom-audience field */ tagMapping?: Record; }; export type GetGoogleBQConfigurationRequest = { application?: string; }; export type GetGoogleBQConfigurationResponse = { /** Connection — service_account_json is write-only and never returned. */ gcpProjectId: string; datasetId: string; datasetRegion: string; serviceAccountClientEmail: string; /** Export */ exportEnabled: boolean; eventTypes: string[]; tableName: string; }; export type CreateGoogleBQConfigurationRequest = { application?: string; /** Connection */ gcpProjectId?: string; datasetId?: string; datasetRegion?: string; /** * service_account_json is mandatory on first save. On update it may be * empty — the existing stored value is kept. */ serviceAccountJson?: string; /** Export */ exportEnabled?: boolean; eventTypes?: string[]; /** optional; defaults to "pushwoosh_events" on the backend */ tableName?: string; }; export type CreateGoogleBQConfigurationResponse = {}; export type DeleteGoogleBQConfigurationRequest = { application?: string; }; export type DeleteGoogleBQConfigurationResponse = {}; /** * TestGoogleBQConnection lets the UI validate credentials before saving. * If service_account_json / gcp_project_id are empty, the backend tests the * stored configuration instead. */ export type TestGoogleBQConnectionRequest = { application?: string; gcpProjectId?: string; datasetId?: string; serviceAccountJson?: string; }; export type TestGoogleBQConnectionResponse = { ok: boolean; /** "auth_failed" / "dataset_not_found" / "missing_permission" / "invalid_input" / "" */ errorCode: string; errorMessage: string; }; /** * ListGoogleBQDatasets surface mirrors TestGoogleBQConnection: inline creds * are optional and, when both are non-empty, override the stored config. * Lets the UI populate a destination-dataset dropdown before the integration * has been saved. */ export type ListGoogleBQDatasetsRequest = { application?: string; gcpProjectId?: string; serviceAccountJson?: string; }; export type ListGoogleBQDatasetsResponse_Dataset = { id: string; region: string; }; export type ListGoogleBQDatasetsResponse = { datasets: ListGoogleBQDatasetsResponse_Dataset[]; }; export type ListGoogleBQTablesRequest = { application?: string; datasetId?: string; }; export type ListGoogleBQTablesResponse_Table = { id: string; /** BigQuery type: "TABLE", "VIEW", "MATERIALIZED_VIEW", "EXTERNAL", "SNAPSHOT" */ type: string; }; export type ListGoogleBQTablesResponse = { tables: ListGoogleBQTablesResponse_Table[]; }; export type SetMetaTagMappingResponse = {};