# Talon.One

Use Airship's External Data Feeds to fetch personalized promotions and loyalty rewards from Talon.One.


Airship's [External Data Feeds](https://www.airship.com/docs/reference/glossary/#external_feed) can fetch personalized promotions and loyalty rewards from [Talon.One](https://www.talon.one/) at message send time. This allows you to deliver highly targeted offers to your users through Airship's messaging channels, with the promotion logic handled by Talon.One's powerful engine.

This integration approach provides the following capabilities:

* Fetch real-time promotion data from Talon.One when sending messages.
* Personalize messages with dynamic coupon codes and offers.
* Leverage Talon.One's promotion engine for eligibility and targeting.
* Maintain a single source of truth for promotions in Talon.One.

## Talon.One integration requirements

This integration requires the following:

* **Accounts**
   1. Talon.One — The account must have permissions to manage API keys.
   1. Airship — The account must include messaging.
* **External API** — See [External API requirements](https://www.airship.com/docs/guides/personalization/sources/external-data-feeds/#external-api-requirements) in the *External Data Feeds* guide.

You must have appropriate permissions in both systems.

## Configuring the integration

To set up the integration, you will create an API key and campaign in Talon.One and an External Data Feed in Airship. Then, you can reference the feed in your Airship messages.

### Create an API Key

In Talon.One:

1. Go to **Apps** and select the application you want to integrate with Airship.
1. Select **Settings**, then **Integration API Keys**.
1. Select **+ Create API Key**.
1. Enter a key name and set an expiration date.
1. For **Third-party integration**, select **Yes**.
1. For **Platform**, select **Customer Engagement Platform**.
1. Select **Create API Key**.

### Create a campaign

In Talon.One:

1. Go to **Apps** and select the application you want to integrate with Airship.
1. Select **+Create Campaign** and enable the **Coupons** option.
1. Select **Create Campaign**.
1. Copy the following values for use in Airship:
   * Destination hostname
   * Authorization key
   * Customer engagement hostname
1. In the browser address bar, copy the URL to capture the Talon.One applicationId and campaignId. The URL also contains the destination hostname. For the example `https://internal.europe-west1.talon.one/applications/359/campaigns/7777`, these are the values for each section:<p>
   * Destination hostname: internal.europe-west1.talon.one
   * applicationId: 359
   * campaignID: 777</p>
   <p>You can return to the URL at any time by editing the campaign.</p>

### Create an External Data Feed

See [Creating a feed](https://www.airship.com/docs/guides/personalization/sources/external-data-feeds/#creating-a-feed) in *External Data Feeds* for information about each setting. The following information is specific to requirements for the Talon.One integration.

In Airship:

1. Next to your project name, select the dropdown menu (
), then **Settings**.
1. Under **Project settings**, select **External Data Feeds**.
1. Select **Create External Data Feed**.
1. Configure the feed using the following information:
   <div class="table-scroll-wrapper">
   <table width="100%" class="reference-table">
      <col style="width:30%">
      <col style="width:70%">
      <thead>
      <tr>
         <th>Setting</th>
         <th>Steps</th>
         </tr>
      </thead>
      <tbody>
      <tr>
         <td>Request URL</td>
         <td>Configure the URL to point to your Talon.One API endpoint: <code>https://integration.talon.one/customer_engagement/coupon?applicationId=applicationId&campaignId=campaignId&externalCampaignId=[[externalCampaignId]]&identifier={{channel_id}}</code>.<p>Replace the parameter values with your actual Talon.One IDs obtained from your campaign URL and add a default value for externalCampaignId, for example, <code>t1</code>.</td>
      </tr>
      <tr>
         <td>Headers</td>
         <td>Enter a key/value pair for each:<p><ul><li><code>Authorization</code> : Your Talon.One API key</li><li><code>Customer-Engagement-Platform-Name</code> : <code>Airship</code></li><li><code>Destination-Hostname</code> : Your destination hostname</li></ul></td>
      </tr>
      <tr>
         <td>Object locations</td>
         <td>Add an object location for the data you want to access. Both the name and location should have value <code>coupon</code>.> **Note:** The Identifier could be any value that’s available in Airship, including [Named User](https://www.airship.com/docs/reference/glossary/#named_user) or any [Attribute](https://www.airship.com/docs/reference/glossary/#attributes). For example, perhaps there is a Loyalty ID with your end users in both platforms stored as an Attribute.
</td>
      </tr>
      </tbody>
      </table>
   </div>
1. Select **Save** to create the feed in your project.

## Using Talon.One data in Airship messages

You add your data feed to messages in two parts:

1. Formatting the message content
1. Determining how to handle the message if the feed fails

For full documentation, see [Using a feed in messages](https://www.airship.com/docs/guides/personalization/sources/external-data-feeds/#using-a-feed-in-messages) in *External Data Feeds*.

### Reference the feed in message content

The JSON response from Talon.One will look something like this:

```json
{
  "ID": 20190408,
  "ApplicationID": 398,
  "CampaignID": 5671,
  "Value": "EW-1BC2",
  "StartDate": "2021-09-30T15:35:02.371569+02:00",
  "ExpiryDate": "2024-10-03T15:35:02.371569+02:00",
  "RecipientIntegrationID": "URN-GV8294NV",
  "UsageLimit": 1,
  "Attributes": {
    "email": "user@example.com",
    "country": "DE"
  }
}
```

When creating message content, use the feed block syntax to access Talon.One data:

```handlebars
{{#feed "talon_promotions" as |data|}}
Here's your exclusive offer: {{data.Value}}
{{/feed}}
```

This should result in an alert with a personalized coupon code:

![An example coupon code from Talon.One data](https://www.airship.com/docs/images/integrations/talon-one-alert-example_hu_b19629bd260f1108.webp)

*An example coupon code from Talon.One data*

### Configure feed failure behavior

In the Delivery step of your message, under **External data feed options**, set the behavior that should occur if the feed fails:

   * **Abort sending the message** — Use this option if the promotion is critical.
   * **Send message without this data** — Use this option if you have fallback content.

## Additional resources

See [Talon.One documentation](https://docs.talon.one) for additional information, including [Create coupon](https://docs.talon.one/third-party-api#tag/Customer-engagement-platforms/operation/cep/createCoupon) in *Customer engagement platform*.
