Skip to main content
added 95 characters in body
Source Link

I wouldn't go through the trouble of pushing this to a DE just so you can reformat your payload. Instead, create a save function on your client-side controller that will request the eventdefinitionkey and then format the payload to send to the back-end of your app on save:

connection.on("requestedTriggerEventDefinition", function(
    eventDefinitionModel
) {
    if (eventDefinitionModel) {
        definition = eventDefinitionModel;
        eventDefinitionKey = eventDefinitionModel.eventDefinitionKey;
    }
});

function save() {
    var campaign_id = $("#campaign_id").val();
    payload["arguments"].execute.inArguments = [{
        campaign_id: campaign_id,
        recipient: {
            first_name: "{{Event." + eventDefinitionKey + '."first_name"}}',
            last_name: "{{Event." + eventDefinitionKey + '."last_name"}}',
            company: "{{Event." + eventDefinitionKey + '."company"}}',
            email: "{{Event." + eventDefinitionKey + '."email"}}',
            address_1: "{{Event." + eventDefinitionKey + '."address_1"}}',
            city: "{{Event." + eventDefinitionKey + '."city"}}',
            state: "{{Event." + eventDefinitionKey + '."state"}}',
            postal_code: "{{Event." + eventDefinitionKey + '."postal_code"}}',
            identifier: "{{Event." + eventDefinitionKey + '."identifier"}}'
        }
    }];
    payload["metaData"].isConfigured = true;
    connection.trigger("updateActivity", payload);
}

Then, in your back-end processing, just decode your JWT to authenticate the request and grab your recipient object from the payload:

var args = decoded.inArguments[0];
var payloadToPostBin = args.recipient;

I wouldn't go through the trouble of pushing this to a DE just so you can reformat your payload. Instead, create a save function on your client-side controller that will request the eventdefinitionkey and then format the payload to send to the back-end of your app on save:

connection.on("requestedTriggerEventDefinition", function(
    eventDefinitionModel
) {
    if (eventDefinitionModel) {
        definition = eventDefinitionModel;
        eventDefinitionKey = eventDefinitionModel.eventDefinitionKey;
    }
});

function save() {
    payload["arguments"].execute.inArguments = [{
        recipient: {
            first_name: "{{Event." + eventDefinitionKey + '."first_name"}}',
            last_name: "{{Event." + eventDefinitionKey + '."last_name"}}',
            company: "{{Event." + eventDefinitionKey + '."company"}}',
            email: "{{Event." + eventDefinitionKey + '."email"}}',
            address_1: "{{Event." + eventDefinitionKey + '."address_1"}}',
            city: "{{Event." + eventDefinitionKey + '."city"}}',
            state: "{{Event." + eventDefinitionKey + '."state"}}',
            postal_code: "{{Event." + eventDefinitionKey + '."postal_code"}}',
            identifier: "{{Event." + eventDefinitionKey + '."identifier"}}'
        }
    }];
    payload["metaData"].isConfigured = true;
    connection.trigger("updateActivity", payload);
}

Then, in your back-end processing, just decode your JWT to authenticate the request and grab your recipient object from the payload:

var args = decoded.inArguments[0];
var payloadToPostBin = args.recipient;

I wouldn't go through the trouble of pushing this to a DE just so you can reformat your payload. Instead, create a save function on your client-side controller that will request the eventdefinitionkey and then format the payload to send to the back-end of your app on save:

connection.on("requestedTriggerEventDefinition", function(
    eventDefinitionModel
) {
    if (eventDefinitionModel) {
        definition = eventDefinitionModel;
        eventDefinitionKey = eventDefinitionModel.eventDefinitionKey;
    }
});

function save() {
    var campaign_id = $("#campaign_id").val();
    payload["arguments"].execute.inArguments = [{
        campaign_id: campaign_id,
        recipient: {
            first_name: "{{Event." + eventDefinitionKey + '."first_name"}}',
            last_name: "{{Event." + eventDefinitionKey + '."last_name"}}',
            company: "{{Event." + eventDefinitionKey + '."company"}}',
            email: "{{Event." + eventDefinitionKey + '."email"}}',
            address_1: "{{Event." + eventDefinitionKey + '."address_1"}}',
            city: "{{Event." + eventDefinitionKey + '."city"}}',
            state: "{{Event." + eventDefinitionKey + '."state"}}',
            postal_code: "{{Event." + eventDefinitionKey + '."postal_code"}}',
            identifier: "{{Event." + eventDefinitionKey + '."identifier"}}'
        }
    }];
    payload["metaData"].isConfigured = true;
    connection.trigger("updateActivity", payload);
}

Then, in your back-end processing, just decode your JWT to authenticate the request and grab your recipient object from the payload:

var args = decoded.inArguments[0];
var payloadToPostBin = args.recipient;
Source Link

I wouldn't go through the trouble of pushing this to a DE just so you can reformat your payload. Instead, create a save function on your client-side controller that will request the eventdefinitionkey and then format the payload to send to the back-end of your app on save:

connection.on("requestedTriggerEventDefinition", function(
    eventDefinitionModel
) {
    if (eventDefinitionModel) {
        definition = eventDefinitionModel;
        eventDefinitionKey = eventDefinitionModel.eventDefinitionKey;
    }
});

function save() {
    payload["arguments"].execute.inArguments = [{
        recipient: {
            first_name: "{{Event." + eventDefinitionKey + '."first_name"}}',
            last_name: "{{Event." + eventDefinitionKey + '."last_name"}}',
            company: "{{Event." + eventDefinitionKey + '."company"}}',
            email: "{{Event." + eventDefinitionKey + '."email"}}',
            address_1: "{{Event." + eventDefinitionKey + '."address_1"}}',
            city: "{{Event." + eventDefinitionKey + '."city"}}',
            state: "{{Event." + eventDefinitionKey + '."state"}}',
            postal_code: "{{Event." + eventDefinitionKey + '."postal_code"}}',
            identifier: "{{Event." + eventDefinitionKey + '."identifier"}}'
        }
    }];
    payload["metaData"].isConfigured = true;
    connection.trigger("updateActivity", payload);
}

Then, in your back-end processing, just decode your JWT to authenticate the request and grab your recipient object from the payload:

var args = decoded.inArguments[0];
var payloadToPostBin = args.recipient;