从Marketing Cloud的Journey Builder Config.Json获取InArguments

如何解决从Marketing Cloud的Journey Builder Config.Json获取InArguments

我一直在尝试了解如何与journey Builder上的InArguments / OutArguments一起使用营销云。我一直在阅读Marketingcloud上的文档以及GitHub示例,但仍然无法理解。我相信许多在线信息已经过时或不完整。

这是我的config.json:

    "workflowApiVersion": "1.1","MetaData": {
        "icon": "images/icon.png","iconSmall": "images/iconSmall.png","category": "customer updates"
    },"type": "REST","lang": {
        "en-US": {
            "name": "SampleCA","description": "A Template for a custom journey Builder activity","step1Label": "Configure Activity"
        }
    },"arguments": {
        "execute": {
           "inArguments":[
                {
                    "ContactKey": "{{Context.ContactKey}}"
                }                                   
            ],"outArguments": [],"url": "https://programb.herokuapp.com/execute","verb": "POST","body": "","header": "","format": "json","useJwt": true,"timeout": 10000
        }
    },"configurationArguments": {
      "applicationExtensionKey": "6f382672-1c0f-42e1-ac02-6bec3ad0e57b","save": {
        "url": "https://programb.herokuapp.com/save","verb": "POST"
       },"publish": {
        "url": "https://programb.herokuapp.com/publish","verb": "POST"
      },"stop": {
        "url": "https://programb.herokuapp.com/stop","verb": "POST"       
      },"validate": {
        "url": "https://programb.herokuapp.com/validate","verb": "POST"
      }
    },"wizardSteps": [
        { "label": "Get User Input","key": "step1" }
    ],"userInterfaces": {
        "configModal": {
            "height": 400,"width": 1000,"fullscreen": false
        }
    },"schema": {
        "arguments": {
            "execute": {
                "inArguments": [
                  {
                    "ContactKey": {
                      "dataType": "ContactKey","isNullable": false,"direction" : "in"
                    }
                  }
                ],"outArguments": []
            }
        }
    }
}

和我的customActivity.js:

define([
    'postmonger'
],function (
    Postmonger
) {
    'use strict';
    var connection = new Postmonger.Session();
    var token;
    var payload = {};
    var contactKey;

    $(window).ready(function() {
        connection.trigger('requestTokens');
        connection.trigger('ready');
    });

    connection.on('clickednext',save);

    connection.on('getTokens',function( data ) {
        if( data.error ) {
            console.error( data.error );
        } else {
            tokens = data;
        }
    });
    
    connection.on('initactivity',function(payload) { 
        console.log("INitacTIVITY INitacTIVITY INitacTIVITY INitacTIVITY INitacTIVITY ");
        var hasInArguments = Boolean(
            payload['arguments'] &&
            payload['arguments'].execute &&
            payload['arguments'].execute.inArguments &&
            payload['arguments'].execute.inArguments.length > 0
        );

        var inArguments = hasInArguments ? payload['arguments'].execute.inArguments : {};

        console.log("INARGS INARGS INARGS INARGS INARGS INARGS INARGS INARGS INARGS INARGS INARGS INARGS ");
        console.log(inArguments);
        console.log("INARGS INARGS INARGS INARGS INARGS INARGS INARGS INARGS INARGS INARGS INARGS INARGS ");

        $.each(inArguments,function (index,inArgument) {
            $.each(inArgument,function (key,val) {
                if (key === 'contactKey') {
                    contactKey = val;
                }            
            });
        });
        console.log(payload);

        connection.trigger('updateButton',{
            button: 'next',text: 'done',visible: true
        });
        console.log("INitacTIVITY INitacTIVITY INitacTIVITY INitacTIVITY INitacTIVITY ");
     });



    connection.on('requestedTokens',function(tokens) { 
        token = tokens;
    });

       function save() {
        payload['arguments'].execute.inArguments = [{
            "tokens": token,"contactKey": contactKey
        }];
        
        payload['MetaData'].isConfigured = true;

        console.log(payload);
        connection.trigger('updateActivity',payload);
    }
});

请告诉我如何为进入我的customActivity的每个联系人获取这些InArguments 并在我的应用程序中对其进行操作?

据我了解,当请求“ /”时,我的app.js服务于index.html 然后启动我的customActivity.js脚本,该脚本使用Postmonger模块来回复诸如Init / Ready之类的事件。 任何对此的澄清将不胜感激。

谢谢。

解决方法

通过您的自定义活动的每个联系人都将使用在InArguments属性中设置的参数,对https://programb.herokuapp.com/execute中的arguments.execute.url中的URL执行POST调用。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?