# Webhooks

## Example scenarios

Here are a few scenarios in which you would use webhooks:

* If you want to have an internal points system for your users, webhooks let you add credits to users in your database every time a loyalty action happens.
* If you want to send custom rewards to your users based on the specific loyalty action they take, you can use webhooks to automate this.

## Getting started

### Step 1: Add a webhook URL to your program

1. Go to the *Options* step in the *Program Editor*.
2. In the *Set up integrations* sectio&#x6E;*,* click the *Webhooks* card. Then enter your webhook endpoint URL.
3. Publish/save your changes.

<figure><img src="https://3285719719-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTwFF4MDnpq2eL5eyOdtK%2Fuploads%2FsztcieXLEvImmCNCYv3B%2FScreen%20Shot%202023-01-11%20at%206.31.15%20PM.png?alt=media&#x26;token=413ca1fa-f438-4ef7-b213-fc14a7448858" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Tips:**

* You can test your webhook URL to see if it is set up properly and/or to see the different types of data from each webhook event. Simply click the *Test* button right next to the webhook URL input field.
* You can select the specific events to receive within the *advanced webhook settings* section.
* A total of 5 webhooks can be added per program.
  {% endhint %}

## **Retry logic**

If we are unable to deliver a webhook the first time, LoyaltySurf will attempt to redeliver your webhooks for several days with an exponential back off. After several days of failed attempts we will mark the webhook as undeliverable and it will no longer be retried.

LoyaltySurf uses a queue system with persistent storage, so if our webhook servers ever experience downtime or become unavailable, webhook events will be retried once the servers are restored. You can always check our [System Status page](https://loyaltysurf.io/status) for webhook health.

## **Next steps**

View [Examples](https://docs.loyaltysurf.io/developer-tools/webhooks/examples) of implementing webhooks, or view what the request payloads for webhook events look like:

* [When a participant reaches a reward goal](https://docs.loyaltysurf.io/developer-tools/events-reference#participant_reached_a_goal)
* [When a new participant is added to the program](https://docs.loyaltysurf.io/developer-tools/events-reference#new_participant_added)
* [When the program ends](https://docs.loyaltysurf.io/developer-tools/events-reference#campaign_ended)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.loyaltysurf.io/developer-tools/webhooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
