Cordova branch.io integration to invite to app

I want to use branch.io to generate invite links in a cordova app. So I installed the plugin.

in app.js:

 branch.init(branchIoKey, function(err, data) {
     console.log(err);
     console.log(data);
  });
  $ionicPlatform.on("resume", function(event) {
      console.log('app resume event', event);
      branch.init(branchIoKey, function(err, data) {
          console.log(err)
          console.log(data);
      });
  });

      

So far so good. I also got some results here.

Start EDIT:

Of course, I verified the identity after successful registration / login. Thus, the user is always unique.

end EDIT.

But since then I have no idea:

1) How to get the invite link for the current user that he can share via Mail, Twitter, Facebook, SMS, etc.?

2) How can I tell on another device if the app was installed via such a link to the branch.io prompt?

3) How do I create such a beautiful welcome page with a photo and referrer name if I find such a link?

The branch.io documentation is a more or less rough installation guide plus API documentation. It is not enough that the example code for this case is not included anywhere. At least I didn't find a hint.

They have 4 steps on their page: SHARE, CLICK, DOWNLOAD, PERSONALIZE. The last issue is not being considered.

I just want to reward the referrer in some apps for every successful invite.

+3


source to share


1 answer


I can help here! I recently went back and updated almost all of the documentation on our developer portal for all platforms we support. Until then, they were pretty bare bones. You can see the full documentation there :

To answer your questions:

  • To create links, you need to use the method link()

    .

Below is an example, but the full link is here :

branch.link({
    channel: 'facebook',
    feature: 'share',
    data: {
        mydata: 'something',
        foo: 'bar',
        '$desktop_url': 'http://myappwebsite.com',
        '$og_title': 'Check out my app',
        '$og_description': 'My app is disrupting apps.',
        '$og_image_url': 'http://myappwebsite.com/image.png'
    }
}, function(err, link) {
    console.log(err, link);
});

      



  1. To determine if a device is installed over the Branch link, you just need to find some of the custom management options that we conveniently associate with the callback first +clicked_branch_link

    .

Here's an example snippet that shows how it's done:

branch.init("YOUR BRANCH KEY HERE", function(err, data) {
    if (!err) {
        var prettyData = JSON.parse(data.data);
        if (prettyData["+clicked_branch_link"]) {
            // do some stuff
        }
    }
});

      

  1. We're in the process of building an awesome full invitation SDK, but at the same time, you'll have to build one yourself.

Basically, I suggest uploading a personal welcome view if you find the user is taken from the thread's invite link. If you put all the user data links into the link when you create it during the transition, you can pre-fill in a personal hello and even show the user's face if so.

+1


source







All Articles