> For the complete documentation index, see [llms.txt](https://kbase.whitelabel-loyalty.com/product/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kbase.whitelabel-loyalty.com/product/loyalty-engine/audiences/audience-tutorials/create-campaigns-for-joining-or-leaving-an-audience.md).

# Create campaigns for joining or leaving an audience

## Introduction

campaigns that trigger when an end-user joins or leaves an audience is a great way to incentivise and reward specific behaviour. You can use them in addition to your main loyalty offering, or even as part of the core logic of your program.

***

## Configuration

{% hint style="info" %}
The `AUDIENCE_JOINED` and `AUDIENCE_LEFT` events will not appear in your event types list until you have created an audience with them enabled.
{% endhint %}

{% hint style="info" %}
The setup of the reactor is identical for both `AUDIENCE_JOINED` and `AUDIENCE_LEFT` events, so this tutorial will combine the two.
{% endhint %}

1. Navigate to Campaigns. Click 'Create' in the top right corner.
2. Give the reactor a name and choose `AUDIENCE_JOINED` or `AUDIENCE_LEFT` from the 'Event type' list.
3. Choose whether you want this reactor to occur an unlimited number of times or be limited to user or tenant activations.
4. Move to the 'Payload Constraints' tab. Click 'Is Audience' in the 'Audiences' section. Select the audience you want the `AUDIENCE_JOINED` or `AUDIENCE_LEFT` event to be related to in order for this reactor to trigger. This will create a JSON schema which references the `audienceId` of that audience.
5. Move to the 'Reactions' tab. Configure the reaction as needed. For more information about how to configure a reaction see the [Broken mention](broken://pages/6cyPKSw1as720GFHniIk#reactions) page.
6. Optional - Move to the 'Effectivity' tab. Set a start date and an end date for the reactor. If you'd like the reactor to run immediately and indefinitely skip this step.
7. Click 'Save'.

***

## Tips

* Not selecting a particular audience in step four of the tutorial will mean that the reactor will trigger when an `AUDIENCE_JOINED` or `AUDIENCE_LEFT` event is reported for any audience.
* Depending on your audience criteria setting an activation limit may not be needed in order to ensure the user only triggers the reactor a certain number of times. Consider adding one as an extra layer of security. For example;

> Imaging you have an audience which an end-user joins when they make their first purchase. A corresponding `AUDIENCE_JOINED` reactor for this audience wouldn't need an activation limit, as a user is only ever going to be able to join that audience once. However, setting an activation limit ensures that if the audience criteria contained errors or was changed in the future then the user is still only going to be able to trigger the reactor once.

* You can specify multiple audiences within the payload constraints by using the following schema in advanced mode. You can find the audienceId of an audience in the URL shown when viewing an audience in the console.

  ```json
  {
      "type": "object",
      "$schema": "http://json-schema.org/draft-06/schema#",
      "properties": {
          "audienceId": {
              "type": "string",
              "enum": [
                  "audienceId1",
                  "audienceId2",
                  "audienceId3"
              ]
          }
      },
      "required": []
  }
  ```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kbase.whitelabel-loyalty.com/product/loyalty-engine/audiences/audience-tutorials/create-campaigns-for-joining-or-leaving-an-audience.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
