/*** * * SaaSquatch Type Definitions * * This file was automatically generated. DO NOT edit it by hand, instead edit the related JSON Schema file. * * Generated on 2026-03-20T21:11:42.771Z * ***/ /*** * Webhook.schema.json * Generated on 2026-03-20T21:11:43.874Z * This file was automatically generated. DO NOT edit it by hand, instead edit the related JSON Schema file. ***/ /** * The types of webhooks supported by SaaSquatch with their corresponding structures. */ export type WebhookSchema = (({ type?: "user.created" data?: ClassicUserCreatedWebhookSchema [k: string]: unknown } | { type?: "coupon.created" data?: CouponCreatedWebhookSchema [k: string]: unknown } | { type?: "reward.created" data?: RewardCreatedWebhookSchema [k: string]: unknown } | { type?: "referral.started" data?: ReferralDataWebhookSchema [k: string]: unknown } | { type?: "referral.converted" data?: ReferralDataWebhookSchema [k: string]: unknown } | { type?: "export.created" data?: ExportWebhookSchema [k: string]: unknown } | { type?: "export.completed" data?: ExportWebhookSchema [k: string]: unknown } | { type?: "user.reward.balance.changed" data?: UserRewardBalanceChangedWebhookSchema [k: string]: unknown }) & { id: WebhookId type: WebhookType tenantAlias: TenantAlias live: IsLiveTenant created: Created [k: string]: unknown }) /** * Sent whenever a new user is created in SaaSquatch program where the classic program is enabled. */ export type ClassicUserCreatedWebhookSchema = (ClassicUserCreatedWebhookSchema1 | UserCreatedWebhookSchema) /** * The user's unique identifier */ export type UserId = string /** * The user's unique account identifier */ export type AccountId = string /** * The user's email address */ export type Email = (string | null) /** * The user's first name */ export type FirstName = (string | null) /** * The user's last name */ export type LastName = (string | null) /** * The initial of the user's last name */ export type LastInitial = (string | null) /** * The referral code this user will share to refer others */ export type ReferralCode = string /** * The URL to an image of this user */ export type ImageUrl = (string | null) /** * The IP address of this user when they were first seen by SaaSquatch */ export type FirstSeenIP = (string | null) /** * The IP address of this user when they were most recently seen by SaaSquatch */ export type LastSeenIP = (string | null) /** * A timestamp of the date this user was created */ export type DateCreated = number /** * An MD5 has of this user's email address */ export type EmailHash = (string | null) /** * The source of the referral as defined by referral cookie (deprecated) */ export type ReferralSource = (string | null) /** * This user's unique locale */ export type Locale = (string | null) /** * The user's country code */ export type CountryCode = (string | null) /** * The primary referral code associated with the programId key * * This interface was referenced by `ReferralCodes`'s JSON-Schema definition * via the `patternProperty` "^[a-zA-Z0-9-]{1,64}$". */ export type ReferralCode1 = string /** * The anonymous cookie user identifier associated with this user if applicable (see anonymous users) */ export type AnonymousCookieUserId = (string | null) /** * Unique user identifier for tenants using a v1 payment provider integration (e.g. Stripe/Recurly) */ export type PaymentProviderId = (string | null) /** * True if this user can be referred in a program by other users */ export type Referable = boolean /** * The date the referral was blocked */ export type DateBlocked = (string | null) /** * The share link tracked with DIRECT share medium and UNKNOWN engagement medium */ export type DirectShareLink = string /** * The share link tracked with FACEBOOK share medium and UNKNOWN engagement medium */ export type FacebookShareLink = string /** * The share link tracked with TWITTER share medium and UNKNOWN engagement medium */ export type TwitterShareLink = string /** * The share link tracked with EMAIL share medium and UNKNOWN engagement medium */ export type EmailShareLink = string /** * The share link tracked with LINKEDIN share medium and UNKNOWN engagement medium */ export type LinkedInShareLink = string /** * The share link tracked with DIRECT share medium and MOBILE engagement medium */ export type MobileDirectShareLink = string /** * The share link tracked with FACEBOOK share medium and MOBILE engagement medium */ export type MobileFacebookShareLink = string /** * The share link tracked with TWITTER share medium and MOBILE engagement medium */ export type MobileTwitterShareLink = string /** * The share link tracked with EMAIL share medium and MOBILE engagement medium */ export type MobileEmailShareLink = string /** * The share link tracked with DIRECT share medium */ export type DirectShareLink1 = string /** * The share link tracked with FACEBOOK share medium */ export type FacebookShareLink1 = string /** * The share link tracked with TWITTER share medium */ export type TwitterShareLink1 = string /** * The share link tracked with EMAIL share medium */ export type EmailShareLink1 = string /** * The share link tracked with LINKEDIN share medium */ export type LinkedInShareLink1 = string /** * Any codes used to refer this user */ export type ReferredByCodes = string[] /** * Any segments this user belongs to */ export type UserSegments = string[] /** * If the program's primary link is a vanity link then this will be the unencoded link, if not it is the UNKNOWN engagement medium and UNKOWN share medium link */ export type CleanLinkForGivenProgram = string /** * Share link associated with the DIRECT share medium */ export type DirectShareLink2 = string /** * The user's unique identifier */ export type UserId1 = string /** * The user's unique account identifier */ export type AccountId1 = string /** * The user's email address */ export type Email1 = (string | null) /** * The user's first name */ export type FirstName1 = (string | null) /** * The user's last name */ export type LastName1 = (string | null) /** * The URL to an image of this user */ export type ImageUrl1 = (string | null) /** * The IP address of this user when they were first seen by SaaSquatch */ export type FirstSeenIP1 = (string | null) /** * The IP address of this user when they were most recently seen by SaaSquatch */ export type LastSeenIP1 = (string | null) /** * A timestamp of the date this user was created */ export type DateCreated1 = number /** * This user's unique locale */ export type Locale1 = (string | null) /** * The user's country code */ export type CountryCode1 = (string | null) /** * True if this user can be referred in a program by other users */ export type Referable1 = boolean /** * Any codes used to refer this user */ export type ReferredByCodes1 = string[] /** * The anonymous cookie user identifier associated with this user if applicable (see anonymous users) */ export type AnonymousCookieUserId1 = (string | null) /** * The date the referral was blocked */ export type DateBlocked1 = (string | null) /** * Any segments this user belongs to */ export type UserSegments1 = string[] /** * The code to be shared */ export type Code = string /** * The date this code was created */ export type DateCreated2 = number /** * The Id of the program this code was created for */ export type ProgramId = (string | null) /** * Sent whenever a reward is created (when it becomes available, e.g. not pending). */ export type RewardCreatedWebhookSchema = (({ type?: "PCT_DISCOUNT" discountPercent?: DiscountPercent unit?: RewardUnit name?: RewardName [k: string]: unknown } | { type?: "FUELTANK" fuelTankCode?: RewardCode unit?: RewardUnit1 amount?: RewardAmount fuelTankType?: RewardCodeType [k: string]: unknown } | { type?: "CREDIT" unit?: RewardUnit2 assignedCredit?: AssignedCredit redeemedCredit?: RedeemedCredit name?: RewardName1 redemptions?: RewardRedemptions [k: string]: unknown } | { type?: "INTEGRATION" name?: RewardName2 description?: RewardDescription unit?: RewardUnit3 valueInCents?: RewardValue integrationId?: IntegrationId rewardDetails?: RewardDetails [k: string]: unknown }) & { id: RewardId type: RewardType dateCreated: DateRewardCreated dateScheduledFor?: DateScheduledFor dateGiven?: DateGiven dateExpires?: DateExpires dateCancelled?: DateCancelled accountId: AccountId2 userId: UserId2 cancellable: IsCancellable programId?: ProgramId1 rewardSource: RewardSource [k: string]: unknown }) /** * The percent discount to be given (e.g. 1-100) */ export type DiscountPercent = number /** * The unit of this reward */ export type RewardUnit = "%" /** * The name given to this discount reward (e.g. Referrer Reward) */ export type RewardName = string /** * The code associated with this reward (e.g. used in fulfillment) */ export type RewardCode = string /** * The unit of this reward */ export type RewardUnit1 = string /** * The value associated with this reward (e.g. 10% or $100) */ export type RewardAmount = number /** * The type of the redeemable reward associated with the fuel tank code (e.g. is it a discount or credit) */ export type RewardCodeType = ("PCT_DISCOUNT" | "CREDIT") /** * The unit of this reward (e.g. USD) */ export type RewardUnit2 = string /** * The credit assigned to this reward (e.g. amount that can be redeemed) */ export type AssignedCredit = number /** * The amount of credit that has already been redeemed from this reward */ export type RedeemedCredit = number /** * The name given to this credit reward (e.g. Referrer Reward) */ export type RewardName1 = string /** * The unique identifier of this redemption */ export type RedemptionId = string /** * The date this redemption was made */ export type DateRedeemed = number /** * The amount that was withdrawn from this reward */ export type QuantityRedeemed = string /** * A record of how credit was redeemed from this reward */ export type RewardRedemptions = RewardRedemption[] /** * The name of this reward (e.g. Amazon Gift Card) */ export type RewardName2 = string /** * This describe the reward in more detail */ export type RewardDescription = string /** * The unit of this reward (e.g. USD) */ export type RewardUnit3 = string /** * The monetary value of this reward in its fractional unit (e.g. cents) */ export type RewardValue = number /** * The identifier for the integration that issued this reward */ export type IntegrationId = string /** * The unique identifier associated with this reward */ export type RewardId = string export type RewardType = ("PCT_DISCOUNT" | "FUELTANK" | "CREDIT" | "INTEGRATION") /** * The date this reward was created */ export type DateRewardCreated = number /** * The date this reward is scheduled to be given if it starts in a pending state */ export type DateScheduledFor = (number | null) /** * The date this reward was given (became available for use) */ export type DateGiven = (number | null) /** * The date this reward will expire */ export type DateExpires = (number | null) /** * The date this reward was cancelled */ export type DateCancelled = (number | null) /** * The account Id for the user who received this reward */ export type AccountId2 = string /** * The user Id for the user who received this reward */ export type UserId2 = string /** * Whether this reward can be cancelled (e.g. rewards that have already been fulfilled externally cannot be cancelled) */ export type IsCancellable = boolean /** * The program that issued this reward */ export type ProgramId1 = (string | null) /** * The source of this reward (e.g. insight into why this reward was created) */ export type RewardSource = ("FRIEND_SIGNUP" | "REFERRED" | "MANUAL" | "ACTIVATION" | "ACQUISITION" | "RETENTION" | "REACTIVATION" | "AUTOMATED") /** * Sent whenever a referral event happens */ export type ReferralDataWebhookSchema = (ClassicReferralWebhookSchema | ClassicDisabledReferralWebhookSchema) /** * The unique referral identifier */ export type ReferralId = string /** * This user's unique identifier */ export type UserId3 = string /** * The unique identifier of the account this user belongs to */ export type AccountId3 = string /** * The referrers code that was used by the referred for the referral */ export type ReferralCodeUsed = string /** * The sharelink that was used by the referred for the referral */ export type ShareLinkUsed = string /** * The date this referral was created */ export type DateReferralStarted = number /** * The date the referral converted */ export type DateReferralConverted = (number | null) /** * The date this referral was last modified for any reason (e.g. converted, reward added, etc.) */ export type DateReferralModified = (number | null) /** * The date a user was added to or removed from the referral (e.g. removed as a result of user deletion) */ export type DateUserModified = (number | null) /** * The Id of the program this code was created for */ export type ProgramId2 = (string | null) /** * The userId of the referrer user (Classic-Only) */ export type ReferrerUser1 = string /** * The userId of the referred user (Classic-Only) */ export type ReferredUser1 = string /** * A set of fraud flags generated for the classic referral program (Classic-Only) */ export type FraudSignals = ({ [k: string]: unknown } | null) /** * The referral fraud moderation status for the classic program (Classic-Only) */ export type ModerationStatus = ("PENDING" | "ACTIONED") /** * The referral moderation status for the referrer user classic program (Classic-Only) */ export type ReferrerModerationStatus = ("PENDING" | "APPROVED" | "DENIED") /** * The date the referral was marked as paid (Classic-Only) */ export type DateReferralPaid = (number | null) /** * The date the referral ended (Classic-Only) */ export type DateReferralEnded = (number | null) /** * The moderation status for the referred user in the classic program (Classic-Only) */ export type ReferredModerationStatus = ("PENDING" | "APPROVED" | "DENIED") /** * The date the referral was moderated (Classic-Only) */ export type DateModerated = number /** * The rewardId of the classic program referred user's reward if available (Classic-Only) */ export type ReferredReward = (string | null) /** * The rewardId of the classic program referrer user's reward if available (Classic-Only) */ export type ReferrerReward = (string | null) /** * The unique referral identifier */ export type ReferralId1 = string /** * The referrers code that was used by the referred for the referral */ export type ReferralCodeUsed1 = string /** * The sharelink that was used by the referred for the referral */ export type ShareLinkUsed1 = string /** * The date this referral was created */ export type DateReferralStarted1 = number /** * The date the referral converted */ export type DateReferralConverted1 = (number | null) /** * The date this referral was last modified for any reason (e.g. converted, reward added, etc.) */ export type DateReferralModified1 = (number | null) /** * The date a user was added to or removed from the referral (e.g. removed as a result of user deletion) */ export type DateUserModified1 = (number | null) /** * The Id of the program this code was created for */ export type ProgramId3 = (string | null) /** * The unique identifier for this export */ export type ExportId = string /** * The name of this export (e.g. User Details) */ export type ExportName = (string | null) /** * The person or machine that requested this export */ export type Requester = string /** * The status of this export (e.g. is it running/finished?) */ export type Status = ("PENDING" | "ABORTED" | "COMPLETED") /** * The date this export was created */ export type DateCreated3 = number /** * The date this export completed */ export type DateCompleted = (number | null) /** * The email address that will receive a download link for this export when it completes */ export type NotificationEmailAddress = (string | null) /** * The date this export expires (e.g. when it will no longer be downloadable) */ export type DateExpires1 = (number | null) /** * The format this export will be generated in (e.g. CSV or Excel) */ export type OutputFormat = ("XLSX" | "CSV") /** * The type of export generated */ export type ExportType = ("USER" | "REFERRAL" | "REWARD_BALANCE" | "USER_REWARD_BALANCE" | "USER_REFERRAL" | "REFERRAL_PARTICIPANT" | "REDEEMABLE_REWARD_BALANCE") /** * The operation being performed (for exports this is always QUERY) */ export type Operation = string /** * Statistics recorded upon completions of the export */ export type ExportStats = (({ recordsProcessed?: RecordsProcessed errors?: Errors } | (null & { recordsProcessed?: RecordsProcessed errors?: Errors })) & { recordsProcessed?: RecordsProcessed errors?: Errors }) /** * The number of records that were processed to complete this export */ export type RecordsProcessed = number /** * The number of errors that occurred while running this export */ export type Errors = number /** * A link to an uploaded file, if this export was based on an uploaded file (e.g. a list of redemption) */ export type UploadedFileReference = (string | null) /** * The user's unique identifier */ export type UserId4 = string /** * The user's unique account identifier */ export type AccountId4 = string /** * The unit corresponding to this reward balance */ export type RewardBalanceUnit = string /** * The reward balance available to be redeemed */ export type AvailableRewardBalance = number /** * An integer value reflective of when the balance was generated, the greater the value the more recent the balance */ export type ResourceVersion = number /** * A unique Id associated with this webhook */ export type WebhookId = string /** * The type of this webhook */ export type WebhookType = ("user.created" | "coupon.created" | "reward.created" | "referral.started" | "referral.converted" | "export.created" | "export.completed" | "user.reward.balance.changed") /** * The identifier for the tenant that generated this webhook */ export type TenantAlias = string /** * Indicates whether this is a live or test tenant */ export type IsLiveTenant = boolean /** * The date this webhook was created */ export type Created = number /** * Sent whenever a new user is created in SaaSquatch program where the classic program is enabled. */ export interface ClassicUserCreatedWebhookSchema1 { id: UserId accountId: AccountId email?: Email firstName?: FirstName lastName?: LastName lastInitial?: LastInitial referralCode: ReferralCode imageUrl?: ImageUrl firstSeenIP?: FirstSeenIP lastSeenIP?: LastSeenIP dateCreated: DateCreated emailHash?: EmailHash referralSource?: ReferralSource locale?: Locale countryCode?: CountryCode referralCodes: ReferralCodes cookieId?: AnonymousCookieUserId paymentProviderId?: PaymentProviderId referable: Referable dateBlocked?: DateBlocked shareLinks: ShareLinks referredByCodes?: ReferredByCodes customFields?: CustomFields segments?: UserSegments programShareLinks?: ProgramShareLinks } /** * A map of programs to referral codes. */ export interface ReferralCodes { [k: string]: ReferralCode1 } /** * Links this user can share to make referrals * * This interface was referenced by `ClassicUserCreatedWebhookSchema1`'s JSON-Schema * via the `definition` "classicShareLinks". */ export interface ShareLinks { shareLink: DirectShareLink facebookShareLink: FacebookShareLink twitterShareLink: TwitterShareLink emailShareLink: EmailShareLink linkedinShareLink: LinkedInShareLink mobileShareLink: MobileDirectShareLink mobileFacebookShareLink: MobileFacebookShareLink mobileTwitterShareLink: MobileTwitterShareLink mobileEmailShareLink: MobileEmailShareLink EMBED: EmbeddedWidgetShareLinks POPUP: PopupWidgetShareLinks HOSTED: HostedWidgetShareLinks MOBILE: MobileWidgetShareLinks EMAIL: EmailWidgetShareLinks } /** * A list of share links associated with the EMBED engagement medium */ export interface EmbeddedWidgetShareLinks { shareLink: DirectShareLink1 facebookShareLink: FacebookShareLink1 twitterShareLink: TwitterShareLink1 emailShareLink: EmailShareLink1 linkedinShareLink: LinkedInShareLink1 } /** * A list of share links associated with the POPUP engagement medium */ export interface PopupWidgetShareLinks { shareLink: DirectShareLink1 facebookShareLink: FacebookShareLink1 twitterShareLink: TwitterShareLink1 emailShareLink: EmailShareLink1 linkedinShareLink: LinkedInShareLink1 } /** * A list of share links associated with the HOSTED engagement medium */ export interface HostedWidgetShareLinks { shareLink: DirectShareLink1 facebookShareLink: FacebookShareLink1 twitterShareLink: TwitterShareLink1 emailShareLink: EmailShareLink1 linkedinShareLink: LinkedInShareLink1 } /** * A list of share links associated with the MOBILE engagement medium */ export interface MobileWidgetShareLinks { shareLink: DirectShareLink1 facebookShareLink: FacebookShareLink1 twitterShareLink: TwitterShareLink1 emailShareLink: EmailShareLink1 linkedinShareLink: LinkedInShareLink1 } /** * A list of share links associated with the EMAIL engagement medium */ export interface EmailWidgetShareLinks { shareLink: DirectShareLink1 facebookShareLink: FacebookShareLink1 twitterShareLink: TwitterShareLink1 emailShareLink: EmailShareLink1 linkedinShareLink: LinkedInShareLink1 } /** * Any custom fields set for this user */ export interface CustomFields { /** * This interface was referenced by `CustomFields`'s JSON-Schema definition * via the `patternProperty` "^[a-zA-Z0-9_]{1,64}$". * * This interface was referenced by `CustomFields1`'s JSON-Schema definition * via the `patternProperty` "^[a-zA-Z0-9_]{1,64}$". */ [k: string]: (string | boolean | number | null) } /** * Links this user can share to make referrals */ export interface ProgramShareLinks { [k: string]: ProgramShareLink } /** * The primary share links available for this program * * This interface was referenced by `ProgramShareLinks`'s JSON-Schema definition * via the `patternProperty` "^[a-zA-Z0-9-]{1,64}$". */ export interface ProgramShareLink { cleanShareLink: CleanLinkForGivenProgram MOBILE: MobileShareLinks EMAIL: EmailShareLinks UNKNOWN: ShareLinks1 } /** * Share links tracked with the MOBILE engagement medium */ export interface MobileShareLinks { DIRECT: DirectShareLink2 } /** * Share links tracked with the EMAIL engagement medium */ export interface EmailShareLinks { DIRECT: DirectShareLink2 } /** * Share links tracked with the UNKNOWN engagement medium */ export interface ShareLinks1 { DIRECT: DirectShareLink2 } /** * Sent whenever a new user is created in SaaSquatch program where the classic program is disabled. */ export interface UserCreatedWebhookSchema { id: UserId1 accountId: AccountId1 email?: Email1 firstName?: FirstName1 lastName?: LastName1 imageUrl?: ImageUrl1 firstSeenIP?: FirstSeenIP1 lastSeenIP?: LastSeenIP1 dateCreated: DateCreated1 locale?: Locale1 countryCode?: CountryCode1 referralCodes?: ReferralCodes referable: Referable1 referredByCodes?: ReferredByCodes1 cookieId?: AnonymousCookieUserId1 dateBlocked?: DateBlocked1 customFields?: CustomFields1 segments?: UserSegments1 programShareLinks?: ProgramShareLinks } /** * Any custom fields set for this user */ export interface CustomFields1 { /** * This interface was referenced by `CustomFields`'s JSON-Schema definition * via the `patternProperty` "^[a-zA-Z0-9_]{1,64}$". * * This interface was referenced by `CustomFields1`'s JSON-Schema definition * via the `patternProperty` "^[a-zA-Z0-9_]{1,64}$". */ [k: string]: (string | boolean | number | null) } /** * Sent when a new coupon (referral code) is created, often when the user is created or interacts with a newly activated program */ export interface CouponCreatedWebhookSchema { code: Code dateCreated: DateCreated2 programId?: ProgramId } /** * An instance of credit being withdrawn from a reward * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardRedemption". */ export interface RewardRedemption { id: RedemptionId dateRedeemed: DateRedeemed quantityRedeemed: QuantityRedeemed } /** * A map of details about this reward provided by the underlying giftcard provider (e.g. Tango's utid) */ export interface RewardDetails { [k: string]: unknown } /** * Sent whenever a classic referral event happens */ export interface ClassicReferralWebhookSchema { id: ReferralId referrer?: ReferrerUser referred?: ReferredUser referralCodeUsed?: ReferralCodeUsed shareLinkUsed?: ShareLinkUsed dateReferralStarted: DateReferralStarted dateConverted?: DateReferralConverted dateModified?: DateReferralModified dateUserModified?: DateUserModified programId?: ProgramId2 referrerUser: ReferrerUser1 referredUser?: ReferredUser1 fraudSignals?: FraudSignals moderationStatus: ModerationStatus referrerModerationStatus: ReferrerModerationStatus dateReferralPaid?: DateReferralPaid dateReferralEnded?: DateReferralEnded referredModerationStatus: ReferredModerationStatus dateModerated: DateModerated referredReward?: ReferredReward referrerReward?: ReferrerReward } /** * The referrer user in who initiated this referral */ export interface ReferrerUser { id: UserId3 accountId: AccountId3 } /** * The referred user who initiated this referral */ export interface ReferredUser { id: UserId3 accountId: AccountId3 } /** * Sent whenever a referral event happens and the classic program is disabled */ export interface ClassicDisabledReferralWebhookSchema { id: ReferralId1 referrer: ReferrerUser2 referred: ReferredUser2 referralCodeUsed?: ReferralCodeUsed1 shareLinkUsed?: ShareLinkUsed1 dateReferralStarted: DateReferralStarted1 dateConverted?: DateReferralConverted1 dateModified?: DateReferralModified1 dateUserModified?: DateUserModified1 programId?: ProgramId3 } /** * The referrer user in who initiated this referral */ export interface ReferrerUser2 { id: UserId3 accountId: AccountId3 } /** * The referred user who initiated this referral */ export interface ReferredUser2 { id: UserId3 accountId: AccountId3 } /** * Sent whenever a data export activity happens (e.g. export created/completed) */ export interface ExportWebhookSchema { id: ExportId name?: ExportName requester: Requester status: Status dateCreated: DateCreated3 dateCompleted?: DateCompleted mailtoEmail?: NotificationEmailAddress dateExpires?: DateExpires1 outputFormat: OutputFormat task: ExportType operation: Operation params?: ExportFilters stats?: ExportStats fileRef?: UploadedFileReference } /** * These parameters are used to filter the export (e.g. by date or program) */ export interface ExportFilters { [k: string]: unknown } /** * Sent whenever something happens to change this user's available reward balance (e.g. rewards given/expired/etc) */ export interface UserRewardBalanceChangedWebhookSchema { userId?: UserId4 accountId?: AccountId4 unit?: RewardBalanceUnit availableValue?: AvailableRewardBalance resourceVersion?: ResourceVersion [k: string]: unknown }