Using the Postmonger events and payloads
We've highlighted the important items in our config
file, along with the config.json
and index.html
files for our frontend. Now, we'll turn our attention to the customActivity.js
file and go through it in parts, in the same way as the previous section, to identify what is happening within our application.
First, we'll initialize a new Postmonger
session in order to utilize events defined by Marketing Cloud that allows you to interact with Journey Builder:
var connection = new Postmonger.Session(); var payload = {}; $(window).ready(onRender); connection.on('initActivity', initialize); connection.on('clickedNext', save);
Here, we'll call a function, named onRender
, that will execute once the Document Object Model (DOM) is ready and we can begin processing our JavaScript functions...