Skip to main content

How to Generate the RapidoReach User ID

  • So lets talk about first things you’ll need, which are the User ID parameters. The Internal User ID (for each of your users), App ID, and App Key.
internalUserID = User123
appID = 1sJ57hgit
appKey = 838ab4b72d221a585af8b4be7a540234
  • Generate an md5 hash of the combined string using your programming language’s md5 function (eg: using Python 3, it is in a library called hashlib).
concat_input = internalUserID + appID + appKey
checksum = hashlib.md5(concat_input).hexdigest()
  • Combine them all into one to create the RapidoReach UID.
RapidoReach_UID = internalUserID + “-” + appID + “-” + checkSum
  • At last, Repeat this process for each of your users to create their User ID dynamically.

Examples

Here are examples of how to do this process using 3 different programming languages.

Javascript

This Script Produces a RapidoReach User ID using Javascript with crypto library

import  crypto from 'crypto';
let RapidoReachUserId = "" // Final RapidoReach User ID
let UserId = "Test_user_id";
// AppId is your rapidoreach app ID
// AppKey is your rapidoreach app key
var checksum = crypto.createHash('md5').update(UserId+"-"+AppId+"-"+AppKey).digest('hex');
RapidoReachUserId = UserId+"-"+AppId+"-"+checksum,

PHP


<?php
// example code

function GenerateRapidoreachURL($internalUserID, $appID, $securityKey){
$checksum = md5($internalUserID."-".$appID."-".$securityKey);
$iframeURL = "https://www.rapidoreach.com/ofw/?userId=".$internalUserID."-".$appID."-".$checksum;
return $iframeURL;
}

echo GenerateRapidoreachURL("User123", "Kkh1Yqa_b92", "3bed4719e45daf6bd1ddc4c72204dcd5");

Python

This Script Produces a RapidoReach User ID using Python

import hashlib
import sys

endUserId = "User123" #insert internal user ID here
applicationKey = "54dbf08d625158c6d7b055928d6ac0cc" #insert application key here
applicationId = "9145" #insert App ID here.

checkSum = hashlib.md5(endUserId + applicationId + applicationKey)
userId = endUserId + "-" + applicationId + "-" + checkSum.hexdigest()
print(userId)

Ruby

require 'digest'
end_user_id = 'test_user'
app_id = '1'
applicationKey = '00000000000000000000000000000000'
hash = Digest::MD5.hexdigest(end_user_id + app_id + applicationKey)
user_id = "#{end_user_id}-#{app_id}-#{hash[0..9]}”

C#

System.Security.Cryptography;

public class Program
{
public static void Main()
{
var endUserID = "User123"; //assuming a member id for their user to be 3. Make sure to change it for every user
var appId = "9165";
var securityKey = "34101a01e1f305b39d16283d5dd05194";
var hash = CalculateMD5Hash(endUserID + appId + securityKey);
var userId = endUserID + "-" + appId + "-" + hash.ToLower();
var iFrameURL = "https://www.rapidoreach.com/offerwall/?userId=" + userId + "&dob=03-03-1979&sex=1"; //make sure to append the correct dob and sex for every user
Console.WriteLine("Generated user id is :{0}", userId);
Console.WriteLine("Generated iFrameURL is :{0}", iFrameURL);

}
public static string CalculateMD5Hash(string input)
{
// step 1, calculate MD5 hash from input
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);

// step 2, convert byte array to hex string
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
}