# Sequence outcomes

Configure alternatives to a sequence's default ending behavior.

By default, all sequence messages are delivered to users who meet the conditions, but you can configure alternative outcomes.

## Possible outcomes

You can configure the following outcomes for a sequence:

<ul>
<li>
<p><strong>Continue</strong> to an in-app experience ([In-App Automation](https://www.airship.com/docs/reference/glossary/#iaa) or [Scene](https://www.airship.com/docs/reference/glossary/#scene)) or another sequence when Airship sends the last message in the current sequence.</p>
</li>
<li>
<p><strong>Exit the sequence</strong> when a specific event occurs. When configuring the event, you designate it as a conversion or cancellation for reporting.</p>
</li>
<li>
<p><strong>Exit the sequence</strong> when a specific event occurs, <strong>then continue</strong> to an in-app experience or another sequence.</p>
</li>
</ul>

> **Note:** An active in-app automation or scene that is connected downstream of a sequence might display independently of the upstream sequence until the in-app experience updates on a user's device.
> 
> This is because in-app experiences are cached on users' devices then displayed when certain conditions are met. Edits made to individual messages, including connecting an in-app experience downstream of a sequence, are applied upon the next app open or via [background push](https://www.airship.com/docs/guides/messaging/project/enable-features/#setting-behavioral-defaults), if enabled.


## Exit events

You can configure a sequence to exit users based on these events:

   * **App open** — This event occurs when a user opens your Android or iOS app or starts a web session. It applies only to sequences that include those platforms. It is not supported for sequences using the [Inactivity trigger](https://www.airship.com/docs/guides/messaging/messages/sequences/triggers/#inactivity).
  
   * **Contact association** — This event occurs when an anonymous channel is associated with a [Named User](https://www.airship.com/docs/reference/glossary/#named_user).

   * **Commercial opt-in** — This event occurs when a user opts in to [commercial email messaging](https://www.airship.com/docs/developer/api-integrations/email/commercial-transactional/) for the first time. 

   * **Tag change** — This event occurs when a tag is added to, or removed from, a device.
   
   * **Custom event** — This event occurs when a user performs a custom event you select that represents a key value exchange with your customers.
   
   * **Subscription event** — This event occurs when a user opts in to or out of a [Subscription List](https://www.airship.com/docs/reference/glossary/#subscription_list). This exit event can only be configured in the [Journey Map](https://www.airship.com/docs/reference/glossary/#journey_map), not the sequence settings.

Exit events are designated as either *Conversion* or *Cancellation*. Both have the same effect on a sequence, but the classifications are used for reporting and mapping. Their occurrence is evaluated during the delay period configured when [adding each message](https://www.airship.com/docs/guides/messaging/messages/sequences/create/add-messages/).

> **Note:** Sequences triggered by [[Inactivity](https://www.airship.com/docs/reference/glossary/#inactivity_event_trigger)](https://www.airship.com/docs/guides/messaging/messages/sequences/triggers/#inactivity) are automatically configured such that:
>    1. A user becoming active is a conversion event labeled *Reactivation*.
>    1. You cannot configure additional conversion events.


## Continuation

Configuring a sequence to continue to an in-app experience or another sequence creates a [Journey](https://www.airship.com/docs/reference/glossary/#journey). You can configure the downstream component in two ways:

* **Create new** — After entering a name, it is saved as a draft.
* **Insert existing** — Search for and select a sequence or in-app experience in your project. Archived items are excluded from search results.

For downstream sequences, [channel selection](https://www.airship.com/docs/guides/messaging/messages/sequences/create/create/#channels) is eliminated since your audience is predetermined by the upstream sequence.

### Delay period

You can set a delay period — the time Airship should wait before evaluating triggers and conditions for the downstream sequence or in-app experience. The delay period starts after the last message in the upstream sequence is sent or when an [exit event](#exit-events) occurs. The maximum delay period is 90 days.

### In-app experience expiration period

If the downstream in-app automation or scene does not display on a user's device within the default period of 31 days, they will exit the journey. This period starts after any configured [delay period](#delay-period) elapses.

As an alternative to exiting, you can route to a fallback sequence. You can also set a shorter expiration period.

## Configuring continuation

Route users to a sequence or in-app experience when Airship sends the last message in the current sequence or an exit event occurs.

1. Go to **Journeys** and select a sequence.

1. Click  to the right of the sequence or a [previously configured exit event](#configuring-exit-events-and-optional-continuation). A configuration drawer will open.

1. Select *Continuation*. This step is eliminated if configuration is for an exit event.

1. Select *Create new* or *Insert existing*.

1. Set the delay period — the time Airship should wait before evaluating triggers and conditions for the downstream sequence or in-app experience. Enter a value in minutes, hours, or days. The maximum delay period is 90 days.

1. Select *Sequence*, *Scene*, or *In-App Automation*, then enter a name for the draft or search for an existing message.

1. (For in-app experiences only, optional) Edit the expiration period and/or set a fallback sequence.

   If the downstream in-app automation or scene does not display on a user's device within the default period of 31 days, they will exit the [Journey](https://www.airship.com/docs/reference/glossary/#journey). This period starts after any configured delay period elapses. As an alternative to exiting, you can route to a fallback sequence. You can also set a shorter expiration period.

   * **Expiration** — Enter a number of days.
   * **Fallback sequence** — Search for an existing sequence or enter a name for a draft and click **Create new sequence: [draft name]**.

1. Click **Save**.

The map will now show the downstream sequence or in-app experience with a connection to the upstream sequence or exit event.

## Configuring exit events and optional continuation

Exit users from the sequence when an event occurs. You can set up multiple events. After configuring an event, you have the option to then route users to a sequence or in-app experience. See also: [Exit events](https://www.airship.com/docs/guides/messaging/messages/sequences/create/outcomes/#exit-events).

1. Go to **Journeys** and select a sequence.

1. Click  to the right of the sequence. A configuration drawer will open.

1. Select the exit type: *Cancellation Event* or *Conversion Event*.

1. Select the exit event and configure.
   
   * **App open:** No configuration needed.

   * **Contact association:** No configuration needed.

   * **Commercial opt-in:** No configuration needed.

   * **Subscription event:**
      1. Search for and select a subscription list.
      1. Choose whether to exit when the user opts in to or out of the subscription.

   * **Tag change:**
      1. Search for a tag. If the tag you search for does not appear, click **Create [search term]** to create a new tag. You can select a tag group filter before or after searching.
      1. (Optional) Click **Add Another** to add more tags. Airship handles multiple tags as a Boolean OR.
      1. Choose to perform the event when a tag is *Added*, or *Removed*. 
   
   * **Custom event:**
      1. Search for a custom event, then select an event from the listed results. Results are limited to events that occurred in the last 30 days. If your event name does not appear in the search results, click **Use [search term]** to use the event name as typed.

      1. (Optional) Click **Add Another** to add more events. Airship handles multiple events as a Boolean OR.

      1. (Optional) Filter custom events by value or key/value properties. Filtering events this way can help you more precisely target your audience.
         <ol>
         <li>Select <strong>Add event properties</strong> for the custom event.</li>
         <li>Select <strong>Add property</strong>, then <strong>Search for properties</strong> and search for a property, or select <strong>Add event value</strong>.</li>
         <li>If applicable, select the operator you want to use to evaluate the value or property.</li>
         <li>Enter or select the event or property value you want to filter for.</li>
         <li>(Optional) Select the plus icon (
         ) to add an alternative for a filter.</li>
         <li>(Optional) Select <strong>Add property</strong> or <strong>Add event value</strong> to add more filters.</li>
         <li>Select <strong>All</strong> or <strong>ANY</strong> to determine how to evaluate multiple filters and alternatives within each filter.
         <ul>
            <li>ALL = all criteria must be met (boolean AND)</li>
            <li>ANY = any criteria must be met (boolean OR)</li>
            </ul></li>
         <li>Select <strong>Save</strong>.</li>
         </ol>
         > **Note:** The filter **does not** show events and event properties for custom events associated with [Named Users](https://www.airship.com/docs/reference/glossary/#named_user). You can still use events associated with named users as triggers, but you must enter their information manually.
         > **Tip:** <p>You can use file upload to provide multiple values to match against a specified event property&rsquo;s value. <strong>For string properties only.</strong></p>
> <p>For example, for a point-of-sale system that emits events when a sale occurs, an event might have the following data:</p>
> ```js
> name: "sale-completed"
> properties:
>    customer_id: 234234
>    store_id: 103843
>    region: "northwest-usa"
> ```
> 
> <p>To trigger only when sales occur in the regions of <code>northwest-usa</code> and <code>southwest-usa</code> but not <code>midwest-usa</code> or any other region, you would do the following to filter your custom events:</p>
> <ol>
> <li>Search for or enter the property name <code>region</code>.</li>
> <li>Select operator <em>File upload (is one of)</em>.</li>
> <li>Upload a <code>.txt</code> file containing values <code>northwest-usa</code> and <code>southwest-usa</code>.</li>
> </ol>
> <hr>
> <p>Provide your values in a line delimited <code>.txt</code> file. Each value must be on a separate line. 100 KB maximum file size.</p>


      1. (Optional) Set the maximum age for the events. If an event is received after it is older than a certain age, the automation or sequence will not start.
         1. Enable *Event Expiration*.
         1. Enter a value in minutes, hours, days, months, or years.
   
1. (Optional) Enable *Add continuation* and complete the steps above for [Configuring continuation](#configuring-continuation), starting at step 4.

1. Click **Save**.

The map will now show a connection from the sequence to the exit event.
