# Application notifications

> Application notifications allow you to be informed of the changes occurring to your Application.

> For the complete documentation index, see [llms.txt](https://docs.talon.one/llms.txt).

In a similar way to [webhooks][webhooks], notifications send requests to a URL
of your choice with a predefined payload. To view the payload content, see the
[notification schemas][specs].

Depending on the [notification type](#notification-types), the following are
possible:

- Requests are sent either in real time after a qualifying event occurs or based
  on a schedule before it occurs.
- You can configure the request payload size. A larger payload means fewer
  requests are sent, optimizing the use of hardware resources.

To learn about notifications for loyalty programs, see
[Loyalty notifications][loyalty].

## Notification types

A notification type represents a qualifying Application-related event for which
you can create a notification and receive requests, for example, coupons that
are expiring soon.

You can [create][create] and [manage][manage] notifications of the following
types:

### <Campaigns className="icon"/> Campaign-related changes <NotificationCardTag tag="Real-time" /> {#campaign-related-changes}

<Button variant="primary" size="m" href="/outbound-notifications#tag/Campaign-notifications">
  Notification schemas
</Button>

Be notified of the following events in real time:

- A campaign was created, edited, or deleted. Editing includes changes made to
  [mandatory attributes](/docs/product/applications/use-attributes.md#make-attributes-mandatory)
  or the <Settings className="icon"/> **Settings** section of any campaign.
- The state of a campaign changed.
- One or more rules changed.
- The evaluation for one or more campaigns changed.
- A campaign-level collection was
  [created](/docs/product/rules/manage-collections.md#create-a-campaign-level-collection)
  or [edited](/docs/product/rules/manage-collections.md#edit-a-collection).
- Stores were
  [linked](https://docs.talon.one/management-api#tag/Stores/operation/importCampaignStores)
  to a campaign or [disconnected](/management-api#tag/Stores/operation/disconnectCampaignStores) from a campaign. In both cases, a [Campaign
  edited](/outbound-notifications#tag/Campaign-notifications/webhook/campaignEditedNotification)
  notification is triggered.

:::note
- Requests are sent for all the above events and for all the campaigns of the
  Application. You cannot select which requests to receive.
- Requests are categorized by campaign. For example, if a qualifying event
  occurs in two campaigns, a request for each of those campaigns is sent.
- A separate request is sent if the
  [campaign evaluation tree](/docs/product/applications/manage-campaign-evaluation.md)
  changes.
:::

You can create one or more notifications of this type.

Requests are sent every five minutes. This means:

- A request can take up to five minutes to be sent after a qualifying event
  occurs.
- If a qualifying event occurs repeatedly in that interval, the request reflects
  the latest effective change. For example, if a campaign is activated,
  disabled, and activated again in that interval, the request reflects only one
  activation event.

When you [create a notification][create], you can choose to receive requests
that contain up to five objects per request.

### <Strikethrough className="icon"/> Strikethrough pricing updates <NotificationCardTag tag="Real-time" /> <NotificationCardTag tag="Scheduled" />{#strikethrough-pricing-updates}

<Button variant="primary" size="m" href="/outbound-notifications#tag/Strikethrough-pricing-notifications">
  Notification schema
</Button>

Be notified of the following events in real time:

- A
  [cart item catalog](/docs/product/account/dev-tools/manage-cart-item-catalogs.md)
  was updated via the
  [Sync cart item catalog](/integration-api#tag/Catalogs/operation/syncCatalog)
  endpoint, and the update triggered at least one
  [strikethrough rule](/docs/product/rules/overview.md#strikethrough-rules).
- A rule, cart item filter, or
  [value map](/docs/product/rules/manage-value-map.md) was updated.
- A campaign became <StateLabel type="expired" name="Expired" /> or its state
  changed:
  - <StateLabel type="running" name="Running" /> &#8680; <StateLabel
    type="disabled" name="Disabled" />
  - <StateLabel type="disabled" name="Disabled" /> &#8680; <StateLabel
    type="running" name="Running" />
  - <StateLabel type="scheduled" name="Scheduled" /> &#8680; <StateLabel
    type="running" name="Running" />
- A strikethrough notification was created or activated.
- Data was imported into a
  [collection](/docs/product/rules/manage-collections.md), when the collections
  are used in <StateLabel type="running" name="Running" /> campaigns containing
  strikethrough rules.
- A
  [campaign evaluation tree](/docs/product/applications/manage-campaign-evaluation.md)
  was edited, when a campaign containing strikethrough rules is a part of the
  campaign evaluation tree.
- A
  [campaign evaluation group](/docs/product/applications/manage-campaign-evaluation.md)
  was changed, when the campaign is <StateLabel type="running" name="Running" />
  and contains strikethrough rules.
- The
  [value of a custom attribute](/docs/product/account/dev-tools/manage-attributes.md#set-the-value-of-an-attribute)
  with associated entity **Application** or **campaign** was edited, when the
  attribute is used in one of the following places of a <StateLabel
  type="running" name="Running" /> campaign:
  - A strikethrough rule.
  - A [cart item filter](/docs/product/rules/cart-item-filters/overview.md).
  - The payload of a _per-item_ custom effect that is referenced in a
    strikethrough rule.
- The payload of a _per-item_
  [custom effect](/docs/product/account/dev-tools/manage-custom-effects.md) was
  edited.
- The API name of a _per-item_ custom effect was changed, when the effect is
  referenced in a
  [strikethrough rule](/docs/product/rules/create-and-manage-rules.md#create-a-strikethrough-rule)
  of a <StateLabel type="running" name="Running" /> campaign.
- The name, currency, or time zone setting of an Application was changed in the
  [Application settings](/docs/product/applications/create-and-manage-applications.md#edit-the-details-of-an-application),
  when it is referenced in a strikethrough rule of a <StateLabel type="running"
  name="Running" /> campaign.

You can create only one notification of this type.

Requests are generated sequentially. Talon.One
waits for the response of a request before sending the next one.

When you [create a notification][create], you can configure the payload to
contain between 50 and 1000 objects per request.

#### (Optional) Schedule strikethrough pricing updates <ClosedBetaBadge/>

By default, strikethrough pricing updates are sent in real time, as soon as a
change happens. Alternatively, you can schedule updates to be sent before a
campaign with [strikethrough rules](/docs/product/rules/overview.md#strikethrough-rules)
starts, ends, or both. This means that you receive pricing information ahead of time,
rather than when the campaign starts or ends.

If you have already created a notification for real-time updates, and you then
also schedule updates, all requests include an updated payload containing the
`version`, `validFrom`, `startTime`, and `endTime` parameters.

Scheduled and real-time strikethrough pricing updates operate in conjunction.
For example, if updates are scheduled, but there are last-minute changes to a
campaign, updates are sent in real time. This ensures that you receive the
latest and most relevant strikethrough pricing and label information.

:::note
Real-time notifications are not sent at a campaign's [start time](/docs/product/campaigns/settings/manage-campaign-schedule)
or end time when scheduled strikethrough pricing updates are enabled.
:::

### <Coupons className="icon"/> Coupon-related changes <NotificationCardTag tag="Real-time" /> {#coupon-related-changes}

<Button variant="primary" size="m" href="/outbound-notifications#tag/Coupon-notifications">
  Notification schemas
</Button>

Be notified in real time when a coupon is created, edited, or deleted, whether
it happens through the Campaign Manager, Management API, or the Rule Engine.
However, this does not include [imported coupons][importing-coupons].

You can create only one notification of this type.

Requests are sent immediately after a qualifying event occurs.

When you [create a notification][create], you can configure the payload to
contain up to 2000 objects per request. Alternatively, choose to receive a
single request that contains only the batch ID of the coupons.

### <Coupons className="icon"/> Expiring coupons <NotificationCardTag tag="Scheduled" /> {#expiring-coupons}

<Button variant="primary" size="m" href="/outbound-notifications#tag/Coupon-notifications/webhook/expiringCouponsNotification">
  Notification schema
</Button>

Be notified through scheduled triggers when a coupon is close to expiration. You
can add up to three scheduled request triggers, each with a different alert time
before coupon expiration.

You can create only one notification of this type.

| Schedule           | Action                                                                                                                                                                                                                   | Payload size                                                                                    |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
| Daily at 00:00 UTC | Retrieves coupons that meet all of the following criteria:Has an expiration dateExpiration date is <code>today + scheduled days</code> (UTC) | Up to 2000 objects per request,or a single request with the batch IDof the coupons. |

:::note
- The timestamps in the payload refer to the
  [time zone](/docs/product/applications/create-and-manage-applications.md#timezone-impact)
  of the Application. The schedule itself, however, is always based on UTC.
- Requests include coupons that have already been redeemed. To filter out
  redeemed coupons in your integration, you can use the `usageLimit` and
  `usageCounter` fields in the payload.
:::

#### Example

You want to notify customers one week before their coupons expire. You have
added a scheduled trigger for `1` **week before expiration**.

Let's assume the current time is July 15, 00:00 UTC. That means that
`today + 7 days` is **July 22**.

Talon.One checks the following coupons:

| Code   | Expiration date (UTC) | Included inRequest | Reason                               | Calculation                                |
| ------ | --------------------- | ------------------------ | ------------------------------------ | ------------------------------------------ |
| XCUK4M | July 7, 09:20         | **No**                   | Coupon has already expired           | Expiration date is before `today + 7 days` |
| B3YMWA | July 22, 00:00        | **Yes**                  | Coupon expires on the scheduled date | Expiration date is `today + 7 days`        |
| F7RYEP | July 22, 23:59        | **Yes**                  | Coupon expires on the scheduled date | Expiration date is `today + 7 days`        |
| Q9JF5L | July 23, 14:20        | **No**                   | Coupon expires later                 | Expiration date is after `today + 7 days`  |

Talon.One sends a request that contains two coupons expiring on July 22.

## Request logging and retry policy

All notification types have a response timeout of 60 seconds. Requests that time
out are [logged][logs] with no response code.

[Progressively delayed][exp backoff] resend attempts are made up to 10 times
or until a `2xx` response is received, whichever occurs first. Resend attempts are made
when a notification request cannot be sent for the following reasons:

- `5xx` response codes.
- `429 Too Many Requests` response code.
- There's no response at all.

[exp backoff]: https://cloud.google.com/pubsub/docs/subscription-retry-policy#exponential_backoff

## Related pages

- [Manage campaign schedule](/docs/product/campaigns/settings/manage-campaign-schedule.md)
- [Manage campaigns](/docs/product/campaigns/create-and-manage-campaigns.md)
- [Campaign evaluation](/docs/product/applications/evaluation-order-for-rules-and-filters.md)
- [Notification schemas][specs]
- [Loyalty notifications][loyalty]
- [Display notification logs][logs]

[specs]: /outbound-notifications
[loyalty]: /docs/product/loyalty-programs/loyalty-notifications/overview.md
[logs]: /docs/product/account/logs/notification-logs.md
[importing-coupons]: /docs/product/campaigns/coupons/manage-coupons.md#import-coupon-codes
[create]: /docs/product/applications/application-notifications/create-application-notifications.md
[manage]: /docs/product/applications/application-notifications/manage-application-notifications.md
[webhooks]: /docs/product/account/dev-tools/manage-webhooks.md
