如何从来自branch.io

时间:2017-09-21 21:35:20

标签: javascript node.js deep-linking branch.io

我正在使用https://github.com/BranchMetrics/branch-deep-linking-public-api为我的用户创建branch link

我能够成功创建链接,也可以正常工作。但我的链接缺少一个主要数据,即分支机构ID 。这是与Branch ID

上的个人身份相关联的Branch

我也明白,如果我在创建链接时传递$identity_id标记中的值,那么我将能够通过我的链接看到 Branch Identity ID 。但我不知道如何访问此ID。

这是我的代码。

const sendBranchRequest = params => {
    const { path, body, qs, method } = params;
    const options = {
        method
        , uri: `${ baseUrl }/${ path }`
        , headers: {
            "Content-Type": "application/json"
           , "Cache-Control": "no-cache"
          }
        , json: true
    };

    if ( body ) {
        options.body = body
        options.body.branch_key = branchKey;
        options.body.branch_secret = branchSecret;
    }

    return rp( options );
};

const createLink = data => {
    const params = {
        body: { data }
        , method: 'POST'
        , path: 'url'
    };
    return sendBranchRequest( params );
};

提前致谢。

1 个答案:

答案 0 :(得分:2)

分支机构标识是与每个用户关联的内部分支机构用户标识符。您将无法直接使用Branch Identity ID创建链接。

您可以尝试使用分支开发者身份创建分支链接,即可用于跟踪/识别用户的自定义标识。

以下是卷曲示例:

curl -X POST \
\
-H "Content-Type: application/json" \
\
-d '{"branch_key":"<you app key>", 
"campaign":"user identity", "channel":"test", 
"identity":"YOUR_IDENTITY", //set your custom user identity here
"data":"{\"var1\": \"abcd\", 
    \"var2\": \"defg\"
}"}' \
\
https://api.branch.io/v1/url

一旦你创建了一个带有身份的链接,如果没有与身份相关联的identity_id(分支身份ID),我们将创建一个新的(否则将其绑定到现有的identity_id)。

相关问题