How can I access Branch Identity ID from identitie

2019-08-02 21:24发布

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条回答
我命由我不由天
2楼-- · 2019-08-02 22:19

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).

查看更多
登录 后发表回答