JOURNEY BUILDER API ALLOWS YOU TO PROGRAMMATICALLY ACCESS AND INTERACT WITH JOURNEY BUILDER FUNCTIONALIITES.
STEP BY STEP GUIDE TO TRIGGER JOURNEY BUILDER API :
STEP 1 : CREATE AN INSTALL PACKAGE
Create an installed package in your marketing cloud account to create API integration, click here to read more.
Give package name and description
Choose API integration as Component
Select Server-to-Server as your integration type
Choose your scope for the integration and save.
STEP 2 : TEST YOUR INTEGRATION
Install postman and test your integration, to install postman click here.
Request SFMC token :
API - https://{{et_subdomain}}.auth.marketingcloudapis.com/v2/token
Body -
{
"grant_type": "client_credentials",
"client_id": "{{et_clientId}}",
"client_secret": "{{et_clientSecret}}",
"account_id": "{{et_mid}}"
}
From the installed package summary, update your Authentication base URI and update your body with Client Id, Secret and MID (optional).
STEP 3 : CREATE A JAVASCRIPT CODE RESOURCE
In Marketing Cloud, you can also create a code resource or content block and add the below code snippet for generating access token
<script runat="server"language="javascript">
Platform.Load("core", "1");
var MemberID = Platform.Recipient.GetAttributeValue('memberid');
var ClientId = get_config[0]["Client_ID"];
var ClientSecret= get_config[0]["Client_Secret"];
varurl = 'domain/v2/token';
var ContentType = 'application/json';
var payload = {
"client_id": ClientId,
"client_secret": ClientSecret,
"grant_type": "client_credentials"
};
try{
var accessTokenResult = HTTP.Post(url, ContentType, Stringify(payload));
var statusCode = accessTokenResult["StatusCode"];
var response = accessTokenResult["Response"][0];
var accessToken = Platform.Function.ParseJSON(response).access_token;
Variable.SetValue("@accessToken",accessToken);
}
catch(e)
{
Write(e.message);
}
</script>
STEP 4 : CREATE A MULTI-STEP JOURNEY WITH API EVENT SOURCE
Drag and Drop API Event entry source into your canvas
Click on the API Event activity and create a new API Event , while creating a new event API you should also build a sendable data extensions for the Journey, select the sendable data extension and save it.
Configure your journey, validate and activate it. Once Activated copy the event definition key, you may store client Id, secret, AUTH, REST and SOAP API into a data extension.
STEP 5 : Validate you configuration via POSTMAN
Fire Entry Event :
URI - https://{{et_subdomain}}.rest.marketingcloudapis.com/interaction/v1/events
The information provided on this technical blog is for general informational purposes only. As a SFMC (Salesforce Marketing Cloud) Technical Architect, I strive to offer accurate and up-to-date content related to SFMC and its associated technologies. However, please note that technology is constantly evolving, and the information provided may become outdated or inaccurate over time.
The content published on this blog represents my personal views and experiences as a SFMC Technical Architect and does not necessarily reflect the official views or opinions of any organization or employer I may be affiliated with.
While I make every effort to ensure the accuracy and reliability of the information presented, I cannot guarantee its completeness, suitability, or applicability to your specific circumstances. Therefore, it is essential to verify any information provided and make your own independent assessments or seek professional advice if needed.
Furthermore, any actions taken based on the information provided on this blog are at your own risk. I shall not be held liable for any damages, losses, or inconveniences arising from the use of the information presented here.
Please keep in mind that SFMC and its associated technologies are complex and require technical expertise for proper implementation and management. It is recommended to consult with qualified professionals or official SFMC documentation for comprehensive guidance.
Finally, please note that any product or company names mentioned on this blog are trademarks or registered trademarks of their respective owners. The mention of these trademarks or registered trademarks does not imply any endorsement or affiliation with the blog.
By accessing and using this blog, you agree to the terms of this disclaimer. If you do not agree with any part of this disclaimer, please refrain from using this blog.
Comments
Post a Comment