# Notify shape

## Introduction

The **notify** shape is used to create custom notification messages for output to run logs and email messages.&#x20;

To achieve this, you compose a `notification template` within the shape settings, using any combination of static text and variables. When the process flow runs and hits this shape, the notification message is generated from your defined template and is then:

* Output to the run logs AND/OR
* Emailed to recipients in selected notification groups&#x20;

{% hint style="info" %}
A single incoming payload for [any process flow shape](https://open.gitbook.com/~site/site_dIV1g/~/revisions/9dTvdvRJIRVZQXuBMMnJ/process-flows/building-process-flows/process-flow-shapes) should not exceed 500 MB.

We recommend processing multiple, smaller payloads rather than one single payload (1000 x 0.5 MB payloads are more efficient than 1 x 500 MB payload!).

For payloads up to 500 MB, consider adding a[ flow control shape](https://open.gitbook.com/~site/site_dIV1g/~/revisions/9dTvdvRJIRVZQXuBMMnJ/process-flows/building-process-flows/process-flow-shapes/standard-shapes/flow-control-shape) to batch data into multiple, smaller payloads. Payloads exceeding 500 MB should be batched at source.
{% endhint %}

## Need to know

* Notification templates can include dynamic content from [variables](#using-variables-in-notification-templates).
* Email notifications are sent irrespective of whether a process flow is [enabled and deployed](https://doc.wearepatchworks.com/product-documentation/process-flows/managing-process-flows/enabling-and-disabling-a-process-flow/enabling-and-disabling-a-process-flow-without-virtual-enviroments).
* The maximum number of email notifications that can be sent (across all process flows for your company profile) is determined by your [Core subscription tier](https://doc.wearepatchworks.com/product-documentation/getting-started/core-subscription-tiers). If you manage [multiple linked profiles](https://doc.wearepatchworks.com/product-documentation/company-management/multi-company-profiles), each one will have its own allowance.&#x20;
* If you find that emails are not being triggered, your [monthly allowance](#notification-email-allowances) may have been exceeded - please [contact support](https://doc.wearepatchworks.com/product-documentation/raising-a-support-ticket) to verify the cause.

## Notification email allowances

Each Core subscription tier has an [allowance for the number of emails that can be sent each month](https://doc.wearepatchworks.com/product-documentation/getting-started/core-subscription-tiers#core-subscription-tier-allowances) via the `notify` shape). When this allowance is reached, emails are not sent.&#x20;

{% stepper %}
{% step %}
**Your allowance reaches 20% remaining**

* An alert is added to your [notification centre](https://doc.wearepatchworks.com/product-documentation/marketplace/the-notification-centre). This alert is shown for  users in associated email notification groups and is triggered monthly until the issue is resolved.
* A warning message is displayed in subsequent run logs.
* A warning message is displayed on the process flow canvas if the flow includes a notify shape configured for email notifications and is [run manually](https://doc.wearepatchworks.com/product-documentation/process-flows/managing-process-flows/initialising-a-process-flow-manually).
  {% endstep %}

{% step %}
**Your allowance has been reached**

* An alert is added to your [notification centre](https://doc.wearepatchworks.com/product-documentation/marketplace/the-notification-centre). This alert is shown for users in associated email notification groups and is triggered monthly until the issue is resolved.
* A warning message is displayed in subsequent run logs.
* A warning message is displayed on the process flow canvas if the flow includes a notify shape configured for email notifications and is [run manually](https://doc.wearepatchworks.com/product-documentation/process-flows/managing-process-flows/initialising-a-process-flow-manually).
  {% endstep %}
  {% endstepper %}

### Resolving notification allowance alerts

To stop alerts and warnings about your notification email allowance, you can either:

* [Increase your notifications allowance with an email notifications bolt-on](https://doc.wearepatchworks.com/product-documentation/getting-started/core-subscription-tiers#core-subscription-tier-bolt-ons).
* Re-configure any notify shapes to notify via `logs` only.

## Using variables in notification templates

Notification templates can include dynamic content from [payload](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/payload-variables), [flow](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables), and [meta](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/metadata-variables) variables.

{% hint style="warning" %}
Variables return the first 100 characters of the associated content.&#x20;
{% endhint %}

In the example below, we use two [flow variables](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables) to retrieve a store name (`store_name`) and a team name (`query_team`), and a [payload variable](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/payload-variables) (`our_id`) to retrieve required information from the payload:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FwbHaGnDIUfrqF1J7cGiH%2Fnotify%20example%20with%20variables%20c.png?alt=media&#x26;token=8951c5bf-4d84-4cee-863a-7d861c001b43" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can incorporate [payload](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/payload-variables), [flow](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables) and [meta](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/metadata-variables) variables in notify messages.
{% endhint %}

## Adding & configuring a notify shape

**Step 1**\
In your process flow, add the **notify** shape in the usual way:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FWoWGgudl4vBg69ifxbfT%2Fadd%20notify%201a.png?alt=media&#x26;token=2dabf261-1260-49ad-97f7-7ec334ac2270" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 2**\
Select an **alert level** from the dropdown field:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FQh2iok2kWxHwUeXZota1%2Fadd%20notify%202a.png?alt=media&#x26;token=f6b0a714-8397-4326-9e7e-5696f1f7fe5f" alt="" width="331"><figcaption></figcaption></figure></div>

The selection made here determines how this notification is displayed in logs and email messages: &#x20;

| Status  | Display colour |
| ------- | -------------- |
| Success | Green          |
| Info    | Grey           |
| Warning | Orange         |
| Error   | Red            |

{% hint style="info" %}
Email notifications always include`alert level` as a `status`, which can be useful if you want to define mailbox filters based on the alert level. An example message is shown below:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FH5fGKaUcia8zFdIqehVy%2Fnotify%20email%20message.png?alt=media&#x26;token=a4625c10-1b8f-49af-a7d1-ae8a472c45f7" alt="" data-size="original">
{% endhint %}

**Step 3**\
Choose notification channel(s) to be used - i.e. how these notifications should be communicated:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FTjjDHOuwXGEyCubR4oaW%2Fadd%20notify%203a.png?alt=media&#x26;token=10c2377d-83f5-41d6-abaa-a7b7d5954551" alt="" width="327"><figcaption></figcaption></figure></div>

Available options are summarised below:

| Channel    | Outcome                                                                                                                                    |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Email +Log | The defined notification message is sent to any specified email notification groups AND output to run logs.                                |
| Email      | The defined notification message is sent to any specified email notification groups. It is NOT output to run logs.                         |
| Log        | The defined notification message is output to run logs. Email notification groups are not available for selection (so no emails are sent). |

**Step 4**

{% hint style="info" %}
This field is not displayed if the *channel* is set to *log* in the previous step.
{% endhint %}

The *email limit* determines the maximum number of emails that the *notify* shape can send per flow run.:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FO6zSKs1wW4eveaXHzO5i%2Fadd%20notify%204a.png?alt=media&#x26;token=f6ba889f-2920-4eba-8567-33a133117564" alt="" width="329"><figcaption></figcaption></figure></div>

For example, if you select a notification group that contains 20 recipients and set the *email limit* to 10, the first 10 recipients will receive emails and the remaining 10 in the group will NOT receive emails.&#x20;

**Step 5**

{% hint style="info" %}
This field is not displayed if the *channel* is set to *log* in the previous step.
{% endhint %}

If you want to send this notification to email recipients, select the required **notification group**:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FZKLXOtxLAUHeJ0j5gAev%2Fadd%20notify%205a.png?alt=media&#x26;token=97066a50-a047-43d1-9a38-568bd20fcfb6" alt="" width="329"><figcaption></figcaption></figure></div>

{% hint style="info" %}
All defined notification groups are available for selection. If you need to add a new group or check recipients in an existing group, please check our [Notification groups](https://doc.wearepatchworks.com/product-documentation/general-settings/notification-groups) page.
{% endhint %}

{% hint style="info" %}
Remember that the *email limit* defined in the previous step may limit the number of recipients to receive emails. It's a good idea to check how many recipients are in your selected notification group, and that your *email limit* is set appropriately.
{% endhint %}

**Step 6**\
Add your required notification text/variables to the notification template section:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FvRfwFTR6Vla3TasnHF7U%2Fadd%20notify%206a.png?alt=media&#x26;token=2e3efd27-300d-4001-a7ec-f347eb69edf0" alt="" width="328"><figcaption></figcaption></figure></div>

{% hint style="info" %}
Remember that a notification message can include static text and (using [variables](#using-variables-in-notification-templates)) dynamic content.&#x20;
{% endhint %}

If you need more space, you can drag this field further down using the handlebar in the bottom right corner:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F5RxeXT62ep7yvRZ8x0Z1%2Fadd%20notify%205.png?alt=media&#x26;token=d537105e-40d5-4f07-a6fc-068f316e7020" alt="" width="350"><figcaption></figcaption></figure></div>

**Step 7**\
Save the shape.
