Understanding the Requirement
The use case is to create a contact via an object activity and later use the same contact ID in the journey further. The client does not want to have the delay of sync, so as soon as the contact is created, it should be logged in the Data Extension. If the contact is existing, then we need to look up on the email address level. The journey has the API event entry source.
Why the Transactional API is the Solution
The Transactional API is the best solution for this requirement because it allows for real-time interactions with the Data Extensions. By using the Transactional API, we can create a custom activity that can instantly log contacts in the Data Extension without the delay of sync.
The root cause of the delay is the sync process, which can take some time to complete. By using the Transactional API, we can bypass the sync process and instantly log contacts in the Data Extension.
To implement this solution, we need to create a custom activity that uses the Transactional API to create a contact and log it in the Data Extension. We can use the createOrUpdate method of the Transactional API to achieve this.
example.ssjs
var contact = { "email": "[email protected]", "firstName": "John", "lastName": "Doe" };
var options = { "contentType": "application/json" };
var url = "https://your-subdomain.marketingcloudapis.com/v1/contact/";
var response = HTTP.Post(url, options, Stringify(contact));
Once we have created the custom activity, we can use it in our Journey Builder journey to instantly log contacts in the Data Extension.
Implementation Steps
To implement this solution, follow these steps:
Implementation Checklist
- Create a new custom activity in Journey Builder
- Use the Transactional API to create a contact and log it in the Data Extension
- Configure the custom activity to use the Transactional API
- Test the custom activity to ensure it is working correctly
- Use the custom activity in your Journey Builder journey
Frequently Asked Questions
What is the Transactional API?
The Transactional API is a real-time API that allows for interactions with the Data Extensions.
How do I create a custom activity in Journey Builder?
To create a custom activity in Journey Builder, go to the Journey Builder dashboard and click on the “Activities” tab. Then, click on the “Create Activity” button and follow the prompts to create a new custom activity.
Can I use the Transactional API to update existing contacts?
Yes, you can use the Transactional API to update existing contacts. You can use the createOrUpdate method to update existing contacts.
What is the difference between the Transactional API and the Sync API?
The Transactional API is a real-time API that allows for instant interactions with the Data Extensions, while the Sync API is a batch API that syncs data between the Data Extensions and the client.
Need help shipping this in production?
Genetrix builds and untangles Salesforce Marketing Cloud and Agentforce setups for teams that want it done right the first time. If anything in this post sounds familiar, talk to us before it ships.