---
source_url: https://www.pubnub.com/docs/analytics/decisions/create-decisions
title: Create a Decision
updated_at: 2026-09-30T07:20:08.000Z
---

# Create a Decision

## Documentation index

To discover more PubNub resources:

1. Fetch [PubNub's llms.txt](https://www.pubnub.com/llms-full.txt) for a list of available pages in Markdown format.
2. Identify relevant URLs from that index.
3. Fetch the target pages.

Do not assume a path exists, always check the index first.

In this tutorial, you will create a [Decision](https://www.pubnub.com/docs/analytics/decisions.md) in PubNub [Illuminate](https://www.pubnub.com/docs/analytics/decisions/overview.md), connect it to the "Game engagement experiment" Business Object, add two Send Message actions with variables, configure two rules with conditions, and activate the Decision.

## What you will build

By the end of this tutorial, you will have an active Decision called "Send discount code". It evaluates the Message sum metric from the "Game engagement experiment" Business Object and publishes a discount message to a guild's channel whenever that guild sends 100 or more messages within 30 minutes.

The completed Decision will have:

* Two Send Message actions: one for Rockin Guild targeting channel `rockin`, and one for Hurrah targeting channel `hurrah`
* A shared message body that injects three variables: `${message}`, `${discountCode}`, and `${purchasedItem}`
* Two rules, one per guild, each checking that Sum of Messages is at least `100`, matching a specific guild name, and running only that guild's action
* Hit policy set to `Multiple` so both rules can fire in the same evaluation cycle
* Evaluation frequency set to `30 minutes`

## Before you start

To follow this tutorial, confirm you have:

* The active "Game engagement experiment" Business Object from [Create a Business Object](https://www.pubnub.com/docs/analytics/decisions/create-business-objects.md), including the Message sum metric.
* Access to Illuminate in the [Admin Portal](https://admin.pubnub.com/).

For a full explanation of Decision structure, condition operators, action types, and rule configuration, see [Decisions](https://www.pubnub.com/docs/analytics/decisions.md).

## Create the Decision

1. In the [Admin Portal](https://admin.pubnub.com/), go to **Illuminate > Decisions**.
2. Click **Create Decision**. The **Create new Decision** modal opens.
3. Enter `Send discount code` in the **Decision name** field. Add an optional description.
4. Click **Select Business Object** and choose `Game engagement experiment` from the list.
5. Select `an aggregation`, then choose `Message sum` from the metric list.

After you select the metric, the **Conditions** section auto-populates from the metric's data fields: **Sum of Messages** and **Guild Name**. An empty Decision table preview appears with these as columns. Leave the modal open and add two actions before finalizing.

### Action 1: Rockin Guild

1. Click **+ Add action**.
2. Enter `Send discount code - Rockin Guild` in the **Name** field. Add an optional description.
3. Click **Configure**.
4. Select **Send Message** as the action type.
5. Select the publish and subscribe keys for your keyset.
6. Enter `rockin` in the **Channel ID** field.
7. Enter `"${message}. Use ${discountCode} to buy ${purchasedItem}."` in the **Body** field.
8. Click **Save**.

After saving, the variables `${message}`, `${discountCode}`, and `${purchasedItem}` appear as new columns in the Decision table preview.

Each row in this table is one rule. The left-hand columns are conditions that determine when the rule fires. The right-hand columns show one column for each action and one for each variable.

### Action 2: Hurrah

1. Click **+ Add action**.
2. Enter `Send discount code - Hurrah` in the **Name** field. Add an optional description.
3. Click **Configure**.
4. Select **Send Message** as the action type.
5. Select the publish and subscribe keys for your keyset.
6. Enter `hurrah` in the **Channel ID** field.
7. Enter `"${message}. Use ${discountCode} to buy ${purchasedItem}."` in the **Body** field.
8. Click **Save**.

Both actions now appear in the modal. Click **Create** to finalize the Decision and open the rules view.

## Configure rules

After creation, a link to configure rules appears. Click it, or open the Decision and click **Edit Rules**.

Each row you add is one rule. The table has two sections:

* **Conditions** (**Sum of Messages**, **Guild Name**) set when the rule fires.
* **Actions** has one column per action and one per variable. In each action column, `Yes` means the rule runs that action when it fires, and `No` means it doesn't. The variable columns (`message`, `discountCode`, `purchasedItem`) set the values injected into the message body.

:::warning New rules run every action
A new rule has every action set to `Yes`. If you leave it that way, the Rockin Guild rule also publishes to channel `hurrah`, and the Hurrah rule also publishes to channel `rockin`. Set the other guild's action to `No` in each rule.
:::

At the top of the rule editing view, set **Hit Policy** to `Multiple` and **Evaluation frequency** to `30 minutes`. Hit policy `Multiple` means Illuminate fires all matching rules in one evaluation cycle, not only the first.

### Rule 1: Rockin Guild

1. Click **+ Add rule**. A new row appears in the Decision table.
2. In the **Sum of Messages** column, set the operator to `Greater than or equal` and the value to `100`.
3. In the **Guild Name** column, enter `Rockin Guild`.
4. In the **Send discount code - Rockin Guild** column, leave `Yes`.
5. In the **Send discount code - Hurrah** column, select `No`.
6. In the **message** column, enter `You really rock, Rockin Guild!`.
7. In the **discountCode** column, enter `FORTFREE`.
8. In the **purchasedItem** column, enter `Wood Fort`.

This rule runs only **Send discount code - Rockin Guild** when Rockin Guild's message count reaches 100 in the evaluation window.

### Rule 2: Hurrah

1. Click **+ Add rule**. A second row appears in the Decision table.
2. In the **Sum of Messages** column, set the operator to `Greater than or equal` and the value to `100`.
3. In the **Guild Name** column, enter `Hurrah`.
4. In the **Send discount code - Rockin Guild** column, select `No`.
5. In the **Send discount code - Hurrah** column, leave `Yes`.
6. In the **message** column, enter `Hip, Hip, Hurrah!`.
7. In the **discountCode** column, enter `FORTX`.
8. In the **purchasedItem** column, enter `Metal Fort`.

This rule runs only **Send discount code - Hurrah** when Hurrah's message count reaches 100 in the evaluation window.

Click **Save** to save both rules.

## Activate

To activate the Decision, at least one rule and one action must be present and the Business Object must be active. All three conditions are met.

1. Click **Activate**.
2. Select **Activate until manually deactivated**.

Illuminate begins evaluating the Message sum metric every 30 minutes. When a guild's message count reaches 100 or more, the matching rule fires and Illuminate publishes the discount message to that guild's channel.

## What you built

You created "Send discount code", a Decision connected to the "Game engagement experiment" Business Object. You added two Send Message actions: one targeting channel `rockin` for Rockin Guild and one targeting channel `hurrah` for Hurrah. Each action body uses three variables. You configured two rules, each running only its own guild's action: Rule 1 fires when Rockin Guild reaches 100 messages and sends a discount for a Wood Fort to channel `rockin`, Rule 2 fires when Hurrah reaches 100 messages and sends a discount for a Metal Fort to channel `hurrah`. You set hit policy to `Multiple` and evaluation frequency to `30 minutes`, then activated the Decision. Illuminate now evaluates the metric every 30 minutes and fires the matching action when conditions are met. Add this Decision to a [Dashboard](https://www.pubnub.com/docs/analytics/decisions/dashboards.md) to monitor triggered actions alongside the metric data.

Last updated at: 2026-09-30T07:20:08.000Z
