In the Formation platform, you can create a jq transformation to be applied to default Connector Event schemas. This will allow you to produce an alternate payload output in the schema you require.
Some use cases for utilizing transforms are:
- Sending reward events to your loyalty platform API directly versus creating a middleware endpoint.
- Triggering an email directly using your Customer Engagement or Customer Data Platform, or Email Service Provider APIs directly.
- Receiving an abbreviated dataset to your own endpoint for some event types.
Connector Transformations must be created before they can be applied to a Connector.
Create a Transformation
To create a transformation:
- Log in to app.formation.ai
- Navigate to Your Organization > Integrations > Connectors
- Select Create Transformation
- Select which Event Type you'd like to create a transformation for in the Payload Type selector
- Write your jq filter
- Click Run to see a preview of your output (or errors)
- Once you're happy with the output preview, click Create and Save Transformation
For help with jq syntax, we recommend starting with this page. If you need help from the team at Formation, reach out to your CSM.
Example Transformations
Reward Event for Loyalty System
Takes the reward event example from this page and uses only the reward object to create a specific payload that can be used to directly award points & track Formation as the source.
The jq filter:
{
"customer_id": .offer.customer_id,
"reward_amount": .reward.reward_value,
"reward_currency": .reward.reward_currency,
"reward_source": "formation"
}
Produces the following request body to your API:
{
"customer_id": "7fb4fde3-b3c2-4fe9-b7e3-9701b6fef950",
"reward_ammount": "100",
"reward_currency": "dollars",
"reward_source": "formation"
}
Ready Event for ESP
Takes the ready event example from this page and creates an event-based campaign trigger, for either immediate or future actioning.
The jq filter:
{
"customer_id": .offer.customer_id,
"offer_start": .offer.start_time,
"offer_end": .offer.end_time,
"offer_type": .offer.offer_type,
"offer_max_reward": .offer.total_reward.reward_value,
"offer_max_reward_currency": .offer.total_reward.reward_currency,
"step_count": .offer.steps | length
}
Produces the following request body to your API:
{
"customer_id": "7fb4fde3-b3c2-4fe9-b7e3-9701b6fef950",
"offer_end": "2022-04-14T21:03:00",
"offer_max_reward": "100",
"offer_max_reward_currency": "dollars",
"offer_start": "2022-03-31T21:04:00",
"offer_type": "week_streak",
"step_count": 2
}
Activation Event for Engagement Tracking
Takes the activated event example from this page and creates an event that can be leveraged in analytics systems or data warehouses for engagement measurement.
The jq filter:
{
"customer_id": .offer.customer_id,
"offer_id": .offer.unique_offer_id,
"activated_at": .created
}
Produces the following request body to your API:
{
"activated_at": "2022-04-13T21:11:51",
"customer_id": "7fb4fde3-b3c2-4fe9-b7e3-9701b6fef950",
"offer_id": "ac1b99567ced7817ff5f6f0db4ba79375ac7af971969440f3adb7bdd2c753cd2"
}