Use the Connected Content feature to fetch data from your own backend at the moment a message is sent, so the content is always current without updating every user profile.
Connected Content is available in the Push and Email content editors.
1. Prepare your data source
Host a JSON endpoint that Pushwoosh can reach over HTTP(S) and that returns the data you want to display:
{
"product_123": {
"name": "Awesome Gadget",
"prices": { "USD": 29.99, "EUR": 27.99, "GBP": 25.99 }
}
}
2. Fetch the data with the connected_content tag
{% connected_content https://yourserver.com/path/to/your-data.json :save external_data %}
:save external_data stores the JSON response in the external_data variable.
3. Display the data
Check out the {{ external_data.product_123.name }}!
Price: ${{ external_data.product_123.prices.USD }}
4. Personalize with user data
Pushwoosh tags are referenced directly by tag name — {{ TagName }}. There is no user_tags. prefix. You can also pass a tag or the User ID to your backend as a query parameter:
{% connected_content https://yourserver.com/data.json?userId={{ ${userid} }}&cur={{ preferred_currency }} :save external_data %}
The price in your currency is {{ external_data.price }}
Authentication
Pass credentials in the URL, or as HTTP headers with the optional :headers parameter (header values are static and are not interpolated):
{% connected_content https://yourserver.com/data.json :headers {"Authorization": "Bearer YOUR_TOKEN"} :save external_data %}
Important
If your endpoint returns anything other than HTTP 200 OK, the push or email is not sent. Make sure the service is reliable and fast, otherwise sends will be dropped.
Full reference: Liquid templates – Connected Content.
Comments
0 comments
Please sign in to leave a comment.