Registering new users

POST https://app.viral-loops.com/api/v2/events

A header Content-Type: application/json is needed.

Request parameters

{
    "apiToken":"MY_TOKEN",
    "params":{
        "event":"registration",
        "user":{
            "firstname": "the user's firstname",
            "lastname": "the user's lastname",
            "email":"the user's email",
            "extraData": { "internalID": "1234" }
        },
        "referrer":{
            "referralCode": "the referrer's referralCode (if available)"
        },
        "refSource": "the refSource (if available)"
    }
}
  • referrer (optional): You can use either email or referralCode for the referrer. In case of the referralCode, the value should have been captured from the request's querystring that brought the user to the page.
  • refSource (optional): the referral channel that the user followed to land into the page. The value should have been captured from the request's querystring that brought the user to the page.Valid values are: facebook/twitter/reddit/email/copy
  • apiToken (required): The API token of your campaign which you can find in the installation step of your campaign's wizard

Example response:

{
  "referralCode": "E13i-LMv",
  "eventId": "evt_M2VhNTRiMGExMDMwMGYxZmFkMGY",
  "isNew": true
}

GDPR consent

If you want to capture GDPR consent as well, use the following:

{

    "apiToken":"MY_TOKEN",

    "params":{

        "event":"registration",

        "user":{

            "firstname": "the user's firstname",

            "lastname": "the user's lastname",

            "email":"the user's email",

            "extraData": { "internalID": "1234" },

            "consents": {

              "2": true // 2 is the ID of the consent.

            }

        },

        "referrer":{

            "referralCode": "the referrer's referralCode (if available)"

        },

        "refSource": "the refSource (if available)"

    }

}

Consent ID

GDPR consents can be added and enabled in the Settings page of the app. The consent ID is displayed here:

Inviting

You can use this API call to track how many times a participant has invited others. It increases the share counter for the relevant channel.

POST https://app.viral-loops.com/api/v1/social_action

A header Content-Type: application/json is needed.

Request Parameters

{
  "referralCode": "JFI876FDD",
  "postType": "email",
  "apiToken": "MY_TOKEN"
}

Successful response

{
    "status": "ok"
}
  • referralCode: the referralCode of the user doing the invite
  • postType: the channel the invite has been made through. Valid values are facebook, twitter, reddit, email
  • apiToken: The campaign's secret apiToken. Available in the installation step of the campaign wizard.

Getting participant data

Get information about your participants.

GET https://app.viral-loops.com/api/v2/participant_data

A header Content-Type: application/json is needed.

Request Parameters

{
  "apiToken": "MY_TOKEN",
  "params": {
    "participants": [{
      "email": "zisis@viral-loops.com"
    }, {
      "referralCode": "JFI876FDD"
    }]
  },
  "filter": {
   "limit": 50,
   "skip": 0
  }
}
  • apiToken: The campaign's secret apiToken. Available in the installation step of the campaign wizard.
  • participants (optional): a list of participant emails or referralCodes to get information from.
    If omitted or the list is empty, information for all the participants will be returned. (with a limit of 50, see filter below)
  • filter (optional): Use the filter with a limit and skip argument to paginate through the results. The default (and max) limit is 50 and skip is 0 by default.
    Say you have 120 participants. You will need to run the call 3 times to get information for all of them. The first time with limit:50, skip:0 the first 50 participants will be returned. Then with limit:50 and skip:50 to get the next batch and then with limit:50 and skip:100 for the remaining 20. 

Successful response

{
    "data": [
        {
            "user": {
                "email": "zisis@viral-loops.com",
                "firstname": "zisis",
                "lastname": "",
                "referralCode": "H6Ht5nZWG",
                "createdAt": "2017-12-03 17:12:29",
                "uniqueLink": "https://mycampaign.com?referralCode=H6Ht5nZWG",
                "extraData": { "internalID": "1234" }
            },
            "referrer": {},
            "counters": {
                "referrals": {
                    "total": 1,
                    "facebook": 1,
                    "twitter": 0,
                    "reddit": 0,
                    "copy": 0,
                    "email": 0
                },
                "shares": {
                    "total": 3,
                    "facebook": 2,
                    "twitter": 0,
                    "reddit": 0,
                    "email": 0
                }
            }
        },
        {
            "user": {
                "email": "dimitris@viral-loops.com",
                "firstname": "dimitris",
                "lastname": "",
                "referralCode": "JFI876FDD",
                "createdAt": "2017-12-03 18:29:08",
                "uniqueLink": "https://mycampaign.com?referralCode=JFI876FDD",
                "extraData": { "internalID": "1234" }
            },
            "referrer": {
                "email": "zisis@viral-loops.com",
                "firstname": "zisis",
                "lastname": "",
                "referralCode": "H6Ht5nZWG",
                "createdAt": "2017-12-03 17:12:29",
                "uniqueLink": "https://mycampaign.com?referralCode=H6Ht5nZWG",
                "extraData": { "internalID": "9876" }
            },
            "counters": {
                "referrals": {
                    "total": 0,
                    "facebook": 0,
                    "twitter": 0,
                    "reddit": 0,
                    "copy": 0,
                    "email": 0
                },
                "shares": {
                    "total": 3,
                    "facebook": 1,
                    "twitter": 1,
                    "reddit": 1,
                    "email": 0
                }
            }
        }
    ]
}
Did this answer your question?