import { RpcMethod } from './commonTypes'; import { Tag_Type as pushwoosh_rpc_v2_tags_Tag_Type } from './tags'; export type InboundWebhooksService_Get = RpcMethod; export type InboundWebhooksService_List = RpcMethod; export type InboundWebhooksService_Create = RpcMethod; export type InboundWebhooksService_Update = RpcMethod; export type InboundWebhooksService_Delete = RpcMethod; export type InboundWebhooksService_GetAPIInfo = RpcMethod; export type InboundWebhooksService_Enable = RpcMethod; export type InboundWebhooksService_Disable = RpcMethod; export type InboundWebhooksService_GetActivityLog = RpcMethod; export interface InboundWebhooksService { /** Returns one inbound webhook by its UUID within an application, including the mapped event, identifier config, attribute mappings and status. Use after list_inbound_webhooks to inspect a single webhook's configuration. */ Get: InboundWebhooksService_Get; /** Lists an application's inbound webhooks with paging, name search and status filter, enriched with 30-day trigger counts and last processing status. Use to browse configured inbound webhooks or find a webhook UUID. */ List: InboundWebhooksService_List; /** Creates an inbound webhook for an application (XXXXX-XXXXX) that maps an incoming HTTP payload onto a Pushwoosh event, profile tags and profile fields via JSON paths, generating a new UUID and Bearer secret. The identifier mapping is always required; the event is optional as long as tags are mapped. Use to set up a new inbound integration endpoint; each call creates a distinct webhook. */ Create: InboundWebhooksService_Create; /** Overwrites an inbound webhook's name, event, identifier and both mapping groups by UUID; existing mappings are fully deleted and recreated. Use to reconfigure an existing webhook while keeping its UUID and secret. */ Update: InboundWebhooksService_Update; /** Deletes an inbound webhook by UUID, cascading its attribute mappings. Irreversible; the webhook URL stops accepting incoming calls. */ Delete: InboundWebhooksService_Delete; /** Returns the callable inbound webhook URL, Bearer secret and a ready-to-use curl example for a webhook UUID. Use to obtain the endpoint credentials for configuring the external system that will POST to it. */ GetAPIInfo: InboundWebhooksService_GetAPIInfo; /** Enables an inbound webhook by UUID so it resumes accepting and processing incoming calls. Use to reactivate a previously disabled webhook. */ Enable: InboundWebhooksService_Enable; /** Disables an inbound webhook by UUID so incoming calls are rejected as inactive, without deleting it. Use to temporarily pause an inbound integration; reverse with enable_inbound_webhook. */ Disable: InboundWebhooksService_Disable; /** Returns the recent (last 24h) processing log for an inbound webhook UUID — per-call timestamp, status, error message and raw request — with paging and success/failure totals. Use to debug why incoming calls fail. */ GetActivityLog: InboundWebhooksService_GetActivityLog; } export type EventAttributeItem = { attributeName: string; jsonPath: string; attributeType: pushwoosh_rpc_v2_tags_Tag_Type; }; export type TagMappingItem = { tagName: string; jsonPath: string; tagType: pushwoosh_rpc_v2_tags_Tag_Type; }; export type Status = 'UNKNOWN_STATUS' | 'ENABLED' | 'DISABLED'; export type IdentifierType = 'UNKNOWN_TYPE' | 'HWID' | 'USER_ID' | 'EMAIL' | 'PHONE' | 'TOKEN'; export type WebhookLogStatus = /** Unknown or unspecified status */ 'WEBHOOK_LOG_STATUS_UNKNOWN' /** Webhook processed successfully */ | 'WEBHOOK_LOG_STATUS_SUCCESS' /** Internal server error during processing */ | 'WEBHOOK_LOG_STATUS_INTERNAL_ERROR' /** Validation error in webhook data */ | 'WEBHOOK_LOG_STATUS_VALIDATE_ERROR' /** Webhook is inactive or disabled */ | 'WEBHOOK_LOG_STATUS_WEBHOOK_INACTIVE' /** Authorization error */ | 'WEBHOOK_LOG_STATUS_AUTHORIZATION_ERROR'; export type InboundWebhook = { uuid: string; name: string; event: string; createdAt: Date; updatedAt: Date; identifierType: IdentifierType; identifierJsonPath: string; attributesMapping: EventAttributeItem[]; status: Status; example: string; /** Number of webhook triggers in the last 30 days */ triggeredCount: number; /** Status of the last webhook processing attempt */ webhookLogStatus: WebhookLogStatus; userAutoCreate: boolean; tagsMapping: TagMappingItem[]; }; export type GetInboundWebhookRequest = { application?: string; uuid?: string; }; export type ListInboundWebhooksRequest_OrderBy = 'NAME'; export type ListInboundWebhooksRequest_OrderDirection = 'ASC' | 'DESC'; export type ListInboundWebhooksRequest = { application?: string; /** like %name% */ searchByName?: string; status?: Status; orderBy?: ListInboundWebhooksRequest_OrderBy; orderDirection?: ListInboundWebhooksRequest_OrderDirection; page?: number; perPage?: number; }; export type ListInboundWebhooksResponse = { inboundWebhooks: InboundWebhook[]; page: number; perPage: number; totalPages: number; total: number; }; export type CreateInboundWebhookRequest = { name?: string; application?: string; event?: string; identifierType?: IdentifierType; identifierJsonPath?: string; attributesMapping?: EventAttributeItem[]; example?: string; userAutoCreate?: boolean; tagsMapping?: TagMappingItem[]; }; export type CreateInboundWebhookResponse = { uuid: string; }; export type UpdateInboundWebhookRequest = { uuid?: string; application?: string; name?: string; event?: string; identifierType?: IdentifierType; identifierJsonPath?: string; attributesMapping?: EventAttributeItem[]; example?: string; userAutoCreate?: boolean; tagsMapping?: TagMappingItem[]; }; export type UpdateInboundWebhookResponse = {}; export type DeleteInboundWebhookRequest = { uuid?: string; application?: string; }; export type DeleteInboundWebhookResponse = {}; export type GetAPIInfoRequest = { uuid?: string; application?: string; }; export type GetAPIInfoResponse = { url: string; secret: string; example: string; }; export type EnableInboundWebhookRequest = { uuid?: string; application?: string; }; export type EnableInboundWebhookResponse = {}; export type DisableInboundWebhookRequest = { uuid?: string; application?: string; }; export type DisableInboundWebhookResponse = {}; export type InboundWebhookLogItem = { /** Timestamp when the webhook was processed */ timestamp: Date; /** Processing status */ status: WebhookLogStatus; /** Error description */ message: string; /** Raw request data */ rawRequest: string; statusIdentity: string; statusEvent: string; statusTags: string; userCreated: boolean; }; export type GetActivityLogRequest = { uuid?: string; application?: string; page?: number; perPage?: number; groupStatus?: string; }; export type GetActivityLogResponse = { /** List of webhook log entries for current page */ logItems: InboundWebhookLogItem[]; /** Current page number */ page: number; /** Items per page */ perPage: number; /** Total number of pages */ totalPages: number; /** Total number of log entries */ total: number; /** Total number of successful webhook calls */ totalSuccess: number; /** Total number of failed webhook calls */ totalFailed: number; /** Total number of webhook calls with a partial failure */ totalWarning: number; };