> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notifly.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced personalization

> Use Connected Content to insert data from an external API into a message.

## 1. How Connected Content works

Notifly uses data from your API when it renders a message. GET requests may reuse a cached response. POST requests call the API each time.

### What you can add to a message

1. **Product recommendations.** Recommend products based on a user's past actions.
2. **Account details.** Fetch only the account fields you need to include in the message.
3. **Account and market information.** Include point balances, account balances, or stock prices.
4. **External systems.** Retrieve the information you need from an external service when the message is rendered.

### Supported channels

* Connected Content is available for app push, in-app popups, and web popups. Popups require a template made in the new popup editor and a supported SDK version.

### Supported fields

* When you create an app push campaign, use Connected Content in these fields under **Message and Action**:

  * Message title

  * Message body

  * Action URL. Under **Action**, select **Navigate to URL**, then enter the URL or deep link.

* In the popup template editor, use Connected Content in Text content, Button labels and links, and HTML blocks. To write HTML and Liquid together, use an HTML block. See [Create an in-app popup template](https://docs.notifly.tech/en/user-guide/channel/in-app-message/file.md) and [Create a web popup template](https://docs.notifly.tech/en/user-guide/channel/web-message/file.md) for the available fields.

## 2. Set up Connected Content

### What you need

1. Add the `{% connected_content %}` tag to the message.
2. Specify the URL of the API endpoint to call.
3. To store the response under a different variable name, add `:save`. Without `:save`, read the response from `connected`.

### Example API request

```
{% connected_content https://api.example.com/data :save response %}
```

This tag sends a request to `https://api.example.com/data` and stores the response in `response`.

### Use the response in a message

Use Liquid to display fields from the response. You can also transform those values before displaying them.

```
Example message: {{ response.user_data }}
```

## 3. Syntax and options

### Basic syntax

```
{% connected_content [URL] :[options] %}
```

### Options

1. **`:save`**

   * Stores the API response under the specified variable name. The default name is `connected`.
   * Syntax: `:save variable_name`
   * Example: `{% connected_content https://api.example.com/profile :save user_profile %}`

2. **`:method`**

   * Sets the HTTP method. The default is GET.
   * Supported methods are GET and POST.
   * Example: `{% connected_content https://api.example.com/products/search :method post :body category=books %}`

3. **`:headers`**

   * Sets the HTTP headers to send with the request.
   * Syntax: `:headers { "Header-Name": "Header-Value", ... }`
   * Example: `{% connected_content https://api.example.com/data :headers { "Authorization": "Bearer token" } %}`

4. **`:body`**

   * Sets the body to send in a POST request. Write fields as `key=value` pairs joined by `&`. To send JSON, add `:content_type application/json`. Each value is sent as a JSON string.
   * Syntax: `:body key=value&other=value`
   * Example: `{% connected_content https://api.example.com/products/search :method post :content_type application/json :body user_id={{user["$user_id"]}}&category=books %}`

5. **`:content_type`**

   * Sets the request's Content-Type.
   * Syntax: `:content_type application/json`
   * Example: `{% connected_content https://api.example.com/data :content_type application/json %}`

### Errors and timeouts

* If the API returns a 4xx or 5xx response or the request fails, the message may still send without the expected data. Check that the required value exists. If it is missing, call `{% abort_message() %}`. In a popup, the tag prevents the entire popup from appearing.
* Connected Content requests time out after 15 seconds.

### Process a list of results

Use Liquid conditions or loops to process data from the API.

```
{% connected_content https://api.example.com/products :save products %}{% for product in products.items %}  - {{ product.name }} price: {{ product.price }}{% endfor %}
```

This example fetches a list of products and shows each product's name and price.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.