> For the complete documentation index, see [llms.txt](https://docs.customerglu.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.customerglu.com/schema/webhook-schema.md).

# Webhook Schema

## Reward Webhook Schema

```jsx
{
		"campaignId": "c666f62e-66b9-4ef7-9191-cc70ff4a3as",
		"type": "spinthewheel",
		"rewardType": "points",
		"userId": "281d08d8-34c0-4ed2-9400-20149c15fg",
		"rewardId": "be1f951c-e9e2-49b9-806b-bf3a6573bas",
		"status": "redeemable-seen",
                "transactionId": "4RjchS3UO-6ubJx2TMPmx3OVyoJKcy7dQMpbji1je8Y", //Idempotent
		"rewardName": "25 coins",
		"rewardAmount": 25,
		"body": "You have won 25 coins",
		"rewardExpiry": 1724913123,
		"tnc": ["NA"],
		"code": "CODE123",//optional
		"details": {//optional
		            "userBName": "testuser2", //in case of a reward for a referral
		            "userBId": "testuser2"//in case of a reward for a referral
		            "userAName": "testuser0", //in case of a reward for a referral
		            "userAId": "testuser0"//in case of a reward for a referral
		            "rewardCategory": "RM",//custom attribute
		            "currency":"USD"//custom attribute,
			    "campaignName": "Daily Reward"
        }
//details object can also contain any logic/business specific custom attributes 
//which can be configured as a campaign input
}
```

| FIELD         | TYPE            | DESCRIPTION                                                                                                                                    | VALUES                                                                                                                                                                                                                      |
| ------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| campaignId    | string          | This represents an instance of the campaign.                                                                                                   | Any String Value                                                                                                                                                                                                            |
| type          | enum            | Type of activity                                                                                                                               | "spinthewheel","slotmachine","scratchcard","direct","memorygame","quiz","referral","multistep","streak","activity-scratchcard","collectthestamps","gamechallenge","unity","tossthecoin","rollthedice","unitygame","giftbox" |
| rewardType    | enum            | Type of reward                                                                                                                                 | 'pdr','discount','deliveryDiscount','buyXGetY','freebie','noReward',customReward','coupons','coins','points','cashbacks','stamp','booster'                                                                                  |
| userId        | string          | User Identification.                                                                                                                           | Any String Value                                                                                                                                                                                                            |
| status        | enum            | Describes the state of the coupon                                                                                                              | "redeemable-unseen"                                                                                                                                                                                                         |
| transactionId | string          | Idempotent transaction id that's unique and same for a reward issued for completing an activity within a specific campaign by a specific user. | base64 URL safe string                                                                                                                                                                                                      |
| rewardName    | string          | Title of reward                                                                                                                                | Any String Value                                                                                                                                                                                                            |
| rewardAmount  | number          | Amount of reward that is won by the user                                                                                                       | Any Integer Value                                                                                                                                                                                                           |
| rewardExpiry  | number          | Reward Expiry                                                                                                                                  | Unix timestamp or -1 in-case rewardExpiry is set as never                                                                                                                                                                   |
| body          | string          | Further description around reward.                                                                                                             | Any String Value                                                                                                                                                                                                            |
| tnc           | array of string | Terms and Conditions                                                                                                                           | Any List of Strings                                                                                                                                                                                                         |
| code          | string          | coupon code (if applicable)                                                                                                                    | Any String value                                                                                                                                                                                                            |
| details       | object          | any custom key-value pairs for the reward, configurable by the client                                                                          | Object containing key- value pairs                                                                                                                                                                                          |

## Nudge Webhook Schema

```jsx
{
        "client": "84acf2ac-b2e0-4927-8653-cba2b83816xa",
        "campaignId": "e90eb605-c99f-47fd-9241-73802b58qsx",
        "userId": "testUser-8-aug-10",
        "notificationType": "in-app",
        "pageType": "full-default",
        "content": {
            "title": "Played a game 1 times!",
            "body": "You are doing great! Just play 6 more Games to Win Big!",
            "clickAction": "https://xyz.com/game",
            "image": "",
            "button": {
                "text": "Go to Challenge",
                "action": "https://xyz.com/game"
            }
        },
        "timeRemaning": "",
        "expiry": "",
        "webhookType": "nudge"
    }
```

| FIELD            | TYPE   | DESCRIPTION                                  | VALUES                                                                                        |
| ---------------- | ------ | -------------------------------------------- | --------------------------------------------------------------------------------------------- |
| client           | string | This represents an instance of the client.   | Any String Value                                                                              |
| campaignId       | string | This represents an instance of the campaign. | Any String Value                                                                              |
| userId           | string | User Identification.                         | Any String Value                                                                              |
| notificationType | string | Type of notification                         | Any one of the following value 1. push 2. in-app                                              |
| pageType         | string | Layout of notification                       | Any one of the following 1. full-default 2. middle-default 3. bottom-default 4. bottom-slider |
| timeRemaning     | string | Not utilised                                 | N/A                                                                                           |
| expiry           | string | Not utilised                                 | N/A                                                                                           |
| webhookType      | string | Type of webhook                              | Supported values                                                                              |

| content     | object |                                           |                  |
| ----------- | ------ | ----------------------------------------- | ---------------- |
| title       | string | Heading for notification                  | Any String Value |
| body        | string | Body of the notification                  | Any String Value |
| clickAction | string | Activity to perform on click              | Any String Value |
| image       | string | Image displayed in notification container | Any String Value |

| button | object |                                     |                  |
| ------ | ------ | ----------------------------------- | ---------------- |
| text   | string | Text on the CTA button              | Any String Value |
| action | string | Activity to perform on button click | Any String Value |

## [Raw Event Webhook](/schema/webhook-schema/raw-event-webhook-schema.md)

[Check out all schemas of Raw Event Webhook here](/schema/webhook-schema/raw-event-webhook-schema.md)
