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
- Product recommendations. Recommend products based on a user’s past actions.
- Account details. Fetch only the account fields you need to include in the message.
- Account and market information. Include point balances, account balances, or stock prices.
- 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 and Create a web popup template for the available fields.
2. Set up Connected Content
What you need
- Add the
{% connected_content %}tag to the message. - Specify the URL of the API endpoint to call.
- To store the response under a different variable name, add
:save. Without:save, read the response fromconnected.
Example API request
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.3. Syntax and options
Basic syntax
Options
-
: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 %}
- Stores the API response under the specified variable name. The default name is
-
: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 %}
-
: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" } %}
-
:body- Sets the body to send in a POST request. Write fields as
key=valuepairs 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 %}
- Sets the body to send in a POST request. Write fields as
-
: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.
