How can I access Branch Identity ID from identities from branch.io

一世执手 提交于 2019-12-11 06:15:57

问题


I am using https://github.com/BranchMetrics/branch-deep-linking-public-api to create a branch link for my users.

I am able to create link successfully which also works fine. But my link is missing one major data which is Branch Identity ID. This is the Branch ID associated with individual identities on Branch

I also understood that if I pass value in $identity_id tag while creating link then I will be able to see Branch Identity ID with my link. But I don't know how to access this id.

Here is my code.

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 );
};

Thanks in advance.


回答1:


The Branch Identity ID is an internal Branch user identifier, associated with each user. You will not be able to use the Branch Identity ID directly to create links.

You can instead try to create Branch links using Branch Developer Identity i.e. a custom identity you can use to track/identify your users.

Here is a sample curl:

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

Once, you create a link with the identity, if there is no identity_id (Branch Identity ID) associated with the identity, we'll create a new one (otherwise tie it to an existing identity_id).



来源:https://stackoverflow.com/questions/46353510/how-can-i-access-branch-identity-id-from-identities-from-branch-io

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!