Customer Experience and Engagement API for Developers

Nothing is impossible with Cloudcherry’s API support

Download our API or contact us for an Integration Request

Customer Experience Management Analytics API

Cloudcherry’s Customer Experience Management Analytics Platform enables brands and business owners across the world to integrate real-time acquisition of Customer Experience(CX) data from their customers, using multiple channels to acquire, engage and analyse.

Why Integrate Real-Time Data Collection and Analysis?

Because only with real-time data can you engage with your customers in an almost one-to-one basis.
It gives you more than one opportunity to fix any and all service issues before it makes its way to the public eye and cause irreparable damage to your brand

  • It helps you understand your customers and how they perceive what you offer – so instead of spending top dollar on research, you can simply learn from our analysis and adapt them to your promised experience
  • To Drill Down data and perform a pre-impact risk analysis so you’ll know exactly what will delight your customers, instead of finding postmortem fixes
  • Save time by tracking enterprise-wide insights on a single dashboard to manage quality and deliver great service consistently across all your locations

Consumer Delight Analytics API

To get started with the Cloudcherry Customer Experience Management(CEM) Analytics API, you need an existing account or you can SIGNUP for a FREE ACCOUNT (50 responses per month/free for life) and Download the CloudCherry Technology Whitepaper

Example CloudCherry API HelloWorld Code

C#JavaPHPSwiftSingle Sign-On(SSO) Token Generation
Using CloudCherry.API NuGet Portable Class Library(PCL)

        // Simply add CloudCherry.API NuGet for drop-in API to your .NET Project.
public class ExampleWithNuGet
        {
            public async Task APIHelloWorld()
            {
                CloudCherry.APIClient client = new CloudCherry.APIClient("https://api.getcloudcherry.com", "yourusername", "yourpassword");
                bool loginstatus = await client.Login();
                
                if(loginstatus)
                {
                    var analytics = await client.GetAnalyticsByLocation(new CloudCherry.FilterBy { afterdate = DateTime.Now.AddMonths(-1) });

                    foreach(var location in analytics)
                    {
                        Console.WriteLine(location.Key + ": " + location.Value.TotalResponses + " Responses");
                        Console.WriteLine("Delight Score: " + location.Value.MDM);
                        Console.WriteLine("NPS: " + location.Value.NetPromoter.NetPromoters);
                        Console.WriteLine("Liked/DisLiked: " + location.Value.Liked + "/" + location.Value.Disliked);
                    }
                }
            }
        }
Using Source Code ( < .NET 4.5 )

        public async void HelloCloudCherryAPI(string username, string password)
        {
            string apiendpoint = "https://api.getcloudcherry.com";
            var client = new HttpClient(); // Create a Instance of Async HttpClient(System.Net.Http)

            //Step 1 : Authenticate To Obtain API Bearer Token To Use With Every API Call
            //Compose Authentication Request
            HttpRequestMessage authrequest = new HttpRequestMessage(HttpMethod.Post, apiendpoint + "/api/LoginToken");
            var postvalues = new[] { 
                new KeyValuePair< string, string >("grant_type", "password"), 
                new KeyValuePair< string, string >("username", username), 
                new KeyValuePair< string, string >("password", password)
            };
            authrequest.Content = new FormUrlEncodedContent(postvalues);
            HttpResponseMessage authresponse = await client.SendAsync(authrequest);
            string responseBodyAsText = await authresponse.Content.ReadAsStringAsync();

            //Deserialize Into Object Using JSON.Net(Newtonsoft.Json)
            var tokenStructure = new { access_token = string.Empty, expires_in = 0 };
            var token = JsonConvert.DeserializeAnonymousType(responseBodyAsText, tokenStructure);
            Console.WriteLine("Authenticated : " + !string.IsNullOrEmpty(token.access_token));
            
            //Step 2: Get Filtered Responses Using API
            var filterfor = new 
            { // Filter Responses as below
                //location = new List { "Downtown" }, // Only for location Downtown
                afterdate = new DateTime(2014, 11, 20), // After Nov 20th 2014
                beforedata = new DateTime(2014, 11, 26)  // Before Nov 26th 2014
            };
            var json = JsonConvert.SerializeObject(filterfor);
            
            //API Endpoint To Query For Responses(Refer WhitePaper)
            string url = apiendpoint + "/api/answers";
            HttpRequestMessage queryrequest = new HttpRequestMessage(HttpMethod.Post, url);
            queryrequest.Content = new StringContent(json, Encoding.UTF8, "application/json");

            //Add Bearer Token To Authenticate This Stateless Request
            queryrequest.Headers.Add("Authorization", "Bearer " + token.access_token);
            var queryresponse = await client.SendAsync(queryrequest);
            var responseBody = await queryresponse.Content.ReadAsStringAsync();

            //Deseralize
            var answerStructure = new { LocationId = string.Empty, ResponseDateTime = new DateTime(), Responses = new List< Response >() };
            var answers = JsonConvert.DeserializeObject< List< Answer > >(responseBody);

            foreach(var a in answers)
            { // Iterate Through Each Response To Print Individual Answers To Each Question Answered
                Console.WriteLine("\nResponse: " + a.LocationId + " " + a.ResponseDateTime);
                foreach (var r in a.Responses)
                    Console.WriteLine(r.QuestionText + ": " + (!string.IsNullOrEmpty(r.TextInput) ? r.TextInput : r.NumberInput.ToString()));
            }


            //Step 3: More API Requests Here ..
            //Ex. Create Questions, Create Multi-Channel Survey Token ...


            //Last Step - Keep Session Clean - Logout
            queryrequest = new HttpRequestMessage(HttpMethod.Get, apiendpoint + "/api/account/logout");
            queryrequest.Headers.Add("Authorization", "Bearer " + token.access_token);
            var logoutAck = await client.SendAsync(queryrequest);

            if (logoutAck.IsSuccessStatusCode)
                Console.WriteLine("Logged Out");
        }
        public class Answer
        {
            public string LocationId { get; set; } // Where
            public DateTime ResponseDateTime { get; set; } // When
            public List< Response > Responses { get; set; } //Answers
        }
        public class Response
        {
            public string QuestionId { get; set; }
            public string QuestionText { get; set; }
            public string TextInput { get; set; } // Text Answer
            public int NumberInput { get; set; } // Numeric Answer
        }
Download Cloud Cherry Java API Client Jar to Reference from your Java Project.

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Map.Entry;

import cloudcherry.*;
import cloudcherry.APIClient.AnalyticsSummary;
import cloudcherry.APIClient.Answer;
import cloudcherry.APIClient.FilterBy;
import cloudcherry.APIClient.NPS;
import cloudcherry.APIClient.Notification;
import cloudcherry.APIClient.Question;
import cloudcherry.APIClient.Response;
import cloudcherry.APIClient.ResponseSummary;
import cloudcherry.APIClient.SSOSubUser;
import cloudcherry.APIClient.SummaryLite;
import cloudcherry.APIClient.SurveyToken;
import cloudcherry.APIClient.TokenSurvey;
import cloudcherry.APIClient.UserSettings;

public class HelloCloudCherryAPI {
	public static APIClient apiclient;
	public static List < Question > questions;
	public static UserSettings settings;
	public static List < Answer > Answers;
	public static FilterBy filter;
	private final static String apiEndPoint = "https://api.getcloudcherry.com";
	public static String username = "";
	public static String password = "";
	static Calendar c;

	public static void main(String[] args) throws Exception {

		String account = "yourusername";
		String ssokey = "yourpassword";
		
		@SuppressWarnings("resource")
		Scanner user_input = new Scanner(System. in );
		apiclient = new APIClient(apiEndPoint, "", "");
		Date Now = new Date();
		c = Calendar.getInstance();
		c.setTime(Now);
		c.add(Calendar.DATE, -30);
		Date after = c.getTime();
		filter = apiclient.new FilterBy();
		filter.beforedate = Now;
		filter.afterdate = after;
		filter.beforetime = new Date();
		filter.afterdate = c.getTime();
		boolean exit = false;
		boolean ISLoggedIn = false;
		while (!exit) {
			if (!ISLoggedIn) {
				System.out.println("");
				System.out.print("Enter your user name: ");
				username = user_input.next(); //Get Username
				System.out.print("Enter your password: ");
				password = user_input.next(); //Get Password
				apiclient = new APIClient(apiEndPoint, username, password);
				ISLoggedIn = apiclient.Login();
			}
			if (ISLoggedIn) {



				String optionValue = "";

				// Display menu graphics
				System.out.println("======================================");
				System.out.println("|   MENU SELECTION                    |");
				System.out.println("======================================");
				System.out.println("| Options:                            |");
				System.out.println("|        1. Get Questions             |");
				System.out.println("|        2. Add Questions             |");
				System.out.println("|        3. Delete Questions          |");
				System.out.println("|        4. Update Questions          |");
				System.out.println("|        5. Get Settings              |");
				System.out.println("|        6. Update Settings           |");
				System.out.println("|        7. Get Answers               |");
				System.out.println("|        8. Post Answer               |");
				System.out.println("|        9. Get Summary               |");
				System.out.println("|       10. Get Analytics By Location |");
				System.out.println("|       11. Get IntersectQuestions    |");
				System.out.println("|       12. Set Filter                |");
				System.out.println("|       13. Get SurveyTokens          |");
				System.out.println("|       14. Get TokenSurvey           |");
				System.out.println("|       15. Add SurveyToken           |");
				System.out.println("|       16. Delete SurveyToken        |");
				System.out.println("|       17. Update SurveyToken        |");
				System.out.println("|       18. Post SurveyBy Token       |");
				System.out.println("|       19. Check API Status          |");
				System.out.println("|       20. DownloadContent           |");
				System.out.println("|       21. Generate SSOUrl           |");
				System.out.println("|       22. Get QRToken               |");
				System.out.println("|       23. Logout (Exit)             |");
				System.out.println("======================================");
				System.out.println("Enter Your Choice: ");
				optionValue = user_input.next();

				switch (optionValue) {
					case "1":
						System.out.println("Get Questions selected");
						List < Question > questions = apiclient.GetQuestions(false);
						if (questions != null) {
							for (Question question: questions) {
								System.out.println("Questions: " + question.ToString());
							}
						}
						break;
					case "2":
						System.out.println("Add Questions selected");
						Question question = apiclient.new Question();
						question.sequence = 2;
						System.out.println("Enter Question Text");
						question.text = user_input.next();
						question.userWeight = 8.0;
						question.goodAfter = new Date();
						Calendar c = new GregorianCalendar();
						c.add(Calendar.DATE, 30);
						Date d = c.getTime();
						question.goodBefore = d;
						question.timeOfDayAfter = new Date();
						question.timeOfDayBefore = new Date();
						question.displayType = "Select";
						question.multiSelect = new ArrayList < String > ();
						question.multiSelect.add("Yeah;yes.png");
						question.multiSelect.add("Nope;No.png");
						question.displayLocation = new ArrayList < String > ();
						question.displayLocation.add("NSK");
						Question addedquestion = apiclient.AddQuestion(question);
						if (addedquestion != null) {
							System.out.println("Added Question: " + addedquestion.ToString());
						}
						break;
					case "3":
						System.out.println("Delete Questions selected");
						System.out.println("Enter Question ID");
						String id = user_input.next();
						Boolean ISdeleted = apiclient.DeleteQuestion(id);
						if (ISdeleted) System.out.println("Deleted");
						else System.out.println("Not Deleted");
						break;
					case "4":
						System.out.println("Update Questions selected");
						Question updatequestion = apiclient.new Question();
						System.out.println("Enter Question ID to update");
						updatequestion.id = user_input.next();
						updatequestion.sequence = 2;
						updatequestion.text = "Updated Question";
						updatequestion.userWeight = 7.0;
						updatequestion.goodAfter = new Date();
						updatequestion.displayType = "MultiSelect";
						updatequestion.multiSelect = new ArrayList < String > ();
						updatequestion.multiSelect.add("Yeah");
						updatequestion.multiSelect.add("Noˆ");
						updatequestion.displayLocation = new ArrayList < String > ();
						updatequestion.displayLocation.add("KSN");
						Question updatedQuestion = apiclient.UpdateQuestion(updatequestion);
						if (updatedQuestion != null) {
							System.out.println("Added Question: " + updatedQuestion.ToString());
						}
						break;
					case "5":
						System.out.println("Get Settings selected");
						settings = apiclient.GetSettings();
						if (settings != null) {
							System.out.println("Settings: " + settings);
						}
						break;
					case "6":
						System.out.println("Update Settings selected");
						if (settings != null) {
							settings.businessType = "Profitable Brand";
							Notification not = apiclient.new Notification();
							not.email = "cc@gmail.com";
							settings.notifications.add(not);
							UserSettings updatedsettings = apiclient.UpdateSettings(settings);
							if (updatedsettings != null) System.out.println("Updated");
							else System.out.println("Not Updated");
						} else System.out.println("Get Your Settings First");
						break;
					case "7":
						System.out.println("Get Answers selected");
						Answers = apiclient.GetAnswers(filter);
						if (Answers != null) {
							int Rindex = 1;
							for (Answer a: Answers) {
								System.out.println("");
								System.out.println("(" + Rindex + ") " + "Response: " + a.locationId + " " + a.responseDateTime);
								System.out.println("-----------------------------------------------");
								System.out.println("");
								if (a.responses != null) {
									for (Response r: a.responses) {
										if (r.textInput == null || r.textInput.isEmpty()) System.out.println(r.questionText + ": " + Integer.toString(r.numberInput));
										else System.out.println(r.questionText + ": " + r.textInput);
									}
								}
								Rindex++;
							}
						}
						break;
					case "8":
						System.out.println("Post Answer selected");
						Answer postanswer = apiclient.new Answer();
						postanswer.responseDateTime = new Date();
						//postanswer.locationId = "NSK";
						postanswer.responses = new ArrayList < Response > ();
						Response res = apiclient.new Response();
						System.out.println("Enter Question Id");
						String QID = user_input.next().trim();
						System.out.println("Enter Text");
						String Qtext = user_input.next().trim();
						res.questionId = QID;
						res.questionText = Qtext;
						res.textInput = "Post Text";
						postanswer.responses.add(res);
						Answer posted = apiclient.PostAnswer(postanswer);
						if (posted != null) {
							System.out.println(posted.id + " Response Time: " + posted.responseDateTime);
						}
						break;
					case "9":
						System.out.println("Get Summary selected");
						ResponseSummary summary = apiclient.GetSummary(filter);
						if (summary != null) {
							System.out.println("Response Count: " + summary.responseCount);
							System.out.println("Delight Score: " + summary.weightedScore);
						}
						break;
					case "10":
						System.out.println("Get Analytics By Location selected");
						Map < String, AnalyticsSummary > Locationsummary = apiclient.GetAnalyticsByLocation(filter);
						if (Locationsummary != null) {
							for (Entry < String, AnalyticsSummary > entry: Locationsummary.entrySet()) {
								System.out.println(entry.getKey());
								AnalyticsSummary analyticssummary = entry.getValue();
								if (analyticssummary != null) {
									System.out.println("Location " + analyticssummary.locationName);
									System.out.println("-----------------------------------------------");
									if (analyticssummary.perDayResponseCount != null) System.out.println("perDayResponseCount " + analyticssummary.perDayResponseCount.size());
									System.out.println("MDM " + analyticssummary.mdm);
									System.out.println("CDMToken " + analyticssummary.cdmToken);
									System.out.println("Total Responses " + analyticssummary.totalResponses);
									System.out.println("Liked " + analyticssummary.liked);
									System.out.println("Disliked " + analyticssummary.disliked);
									NPS nps = analyticssummary.netPromoter;
									if (nps != null) {
										System.out.println("Net Promoters " + nps.netPromoters);
									}
									System.out.println("");
								}
							}
						}
						break;
					case "11":
						System.out.println("Get IntersectQuestions selected");
						String questionid1 = "";
						String questionid2 = "";
						System.out.println("Enter Question1's ID to compare");
						questionid1 = user_input.next().trim();
						System.out.println("Enter Question2's ID to compare");
						questionid2 = user_input.next().trim();
						Map < String, SummaryLite > intersectquestions = apiclient.IntersectQuestions(filter, questionid1, questionid2);
						if (intersectquestions != null) {
							for (Entry < String, SummaryLite > entry: intersectquestions.entrySet()) {
								System.out.println(entry.getKey());
								SummaryLite summarylite = entry.getValue();
								System.out.println("Asked Question " + summarylite.askedQuestion);
								for (Entry < String, Integer > responseEntry: summarylite.response.entrySet()) {
									System.out.println("Values: ");
									System.out.println(responseEntry.getKey() + "/" + responseEntry.getValue());
								}
							}
						}
						break;
					case "12":
						System.out.println("Set Filter (90 days) Selected");
						Now = new Date();
						c = Calendar.getInstance();
						c.setTime(Now);
						c.add(Calendar.DATE, -90);
						after = c.getTime();
						filter = apiclient.new FilterBy();
						filter.afterdate = after;
						filter.beforedate = Now;
						break;
					case "13":
						System.out.println("Get SurveyTokens selected");
						List < SurveyToken > surveytokens = apiclient.GetSurveyTokens();
						if (surveytokens != null) {
							for (SurveyToken surveyToken: surveytokens) {
								System.out.println("");
								System.out.println("SurveyToken ID: " + surveyToken.id);
								System.out.println("SurveyToken Location: " + surveyToken.location);
								System.out.println("SurveyToken emailQuestion: " + surveyToken.emailQuestion);
								System.out.println("SurveyToken validTill: " + surveyToken.validTill);
								System.out.println("SurveyToken validUses: " + surveyToken.validUses);
								System.out.println("");
							}
						}
						break;
					case "14":
						System.out.println("Get TokenSurvey selected");
						System.out.println("EnterToken");
						String Stringtoken = user_input.next().trim();
						TokenSurvey token = apiclient.GetTokenSurvey(Stringtoken);
						if (token != null) {
							System.out.println("");
							System.out.println("Welcome Text: " + token.welcomeText);
							System.out.println("Thankyou Text: " + token.thankyouText);
							System.out.println("");
						}
						break;
					case "15":
						System.out.println("Add SurveyToken selected");
						SurveyToken Tobeadded = apiclient.new SurveyToken();
						Tobeadded.validTill = new Date();
						Tobeadded.validUses = 10;
						SurveyToken Addsurveytoken = apiclient.AddSurveyToken(Tobeadded);
						if (Addsurveytoken != null) {
							System.out.println("SurveyToken ID: " + Addsurveytoken.id);
							System.out.println("SurveyToken validTill: " + Addsurveytoken.validTill);
							System.out.println("SurveyToken validUses: " + Addsurveytoken.validUses);
						}
						break;
					case "16":
						System.out.println("Delete SurveyToken selected");
						String TokenId = "";
						System.out.println("Enter Token Id to delete");
						TokenId = user_input.next().trim();
						boolean isdeleted = apiclient.DeleteSurveyToken(TokenId);
						if (isdeleted) System.out.println("Deleted :" + TokenId);
						else System.out.println("Unable to delete");
						break;
					case "17":
						System.out.println("Update SurveyToken selected");
						SurveyToken Tobeupdated = apiclient.new SurveyToken();
						System.out.println("Enter Token Id to update");
						String UpdateTokenId = user_input.next().trim();
						Tobeupdated.id = UpdateTokenId;
						Tobeupdated.validTill = new Date();
						Tobeupdated.validUses = 10;
						SurveyToken updatedsurveytoken = apiclient.UpdateSurveyToken(Tobeupdated);
						if (updatedsurveytoken != null) {
							System.out.println("SurveyToken ID: " + updatedsurveytoken.id);
							System.out.println("SurveyToken validTill: " + updatedsurveytoken.validTill);
							System.out.println("SurveyToken validUses: " + updatedsurveytoken.validUses);
						}
						break;
					case "18":
						System.out.println("Post SurveyBy Token selected");
						System.out.println("Enter Token Id to Post");
						String PostTokenId = user_input.next().trim();
						Answer a = apiclient.new Answer();
						a.responseDateTime = new Date();
						//a.locationId = "NSK";
						a.responses = new ArrayList < Response > ();
						System.out.println("Enter Question Id");
						String QIDtoken = user_input.next().trim();
						System.out.println("Enter Question Text");
						String Qtexttoken = user_input.next().trim();
						Response r = apiclient.new Response();
						r.questionId = QIDtoken;
						r.questionText = Qtexttoken;
						r.textInput = "Text";
						a.responses.add(r);
						Answer PostedResponse = apiclient.PostSurveyByTokenResponse(PostTokenId, a);
						if (PostedResponse != null) {
							System.out.println(PostedResponse.id + " Response Time: " + PostedResponse.responseDateTime);
						}
						break;
					case "19":
						System.out.println("Check API Status selected");
						boolean check = apiclient.CheckAPIStatus();
						System.out.println("API Alive?? : " + check);
						break;
					case "20":
						System.out.println("DownloadContent selected");
						byte[] Download = apiclient.DownloadContent("https://az592622.vo.msecnd.net/assets/extremelyhappy.png");
						if (Download != null) System.out.println("Downloaded Size : " + Download.length);
						break;
					case "21":
						SSOSubUser subuser = new APIClient.SSOSubUser();
						System.out.println("Enter Userid");
						subuser.userid = user_input.next().trim();
						System.out.println("Enter Role");
						subuser.role = user_input.next().trim();
						System.out.println("Enter Email");
						subuser.email = user_input.next().trim();
						subuser.timeStamp = new Date();
						System.out.println("Enter SSOKey");
						String SSOKey = user_input.next().trim();
						String SSOUrl = APIClient.GenerateSSOUrl(subuser,username,SSOKey);
						if(SSOUrl != null && !SSOUrl.equals(""))
							 System.out.println("SSOUrl : " +SSOUrl);
						else
							System.out.println("Error");
						break;
					case "22":
						System.out.println("Enter Your Token");
						String QRtoken = user_input.next().trim();
						byte[] QRImage = apiclient.DownloadQRToken(QRtoken);
						if(QRImage != null) System.out.println("Downloaded Size : "+QRImage.length);
						break;
					case "23":
						System.out.println("Logout selected");
						boolean ISlogout = apiclient.Logout();
						ISLoggedIn = false;
						username = "";
						password = "";
						System.out.println("Logged Out?? : " + ISlogout);
						System.out.print("Press 'Y' to continue : ");
						String iscontinue = user_input.next();
						if (iscontinue.equalsIgnoreCase("Y")) exit = false;
						else exit = true;
						break;
					default:
						System.out.println("Invalid selection");
						break;
				}
				if (!exit && ISLoggedIn) {
					System.out.print("Press Any Key to continue : ");
					user_input.next();
				}
			} else {
				System.out.println("Error" + apiclient.errorLogin);
				System.out.print("Press 'Y' to continue : ");
				String iscontinue = user_input.next();
				if (iscontinue.equalsIgnoreCase("Y")) exit = false;
				else exit = true;
			}
		}
	}
}
PHP CloudCherry API Client, using CloudCherryAPI PHP Library ( Install Using PHP Composer )

<?php

/* Install PHP CloudCherry API Client using Composer(getcomposer.com)
 * Step-1: curl -sS https://getcomposer.org/installer | php
 * Step-2: php composer.phar require cloudcherry/apiclient
 * Step-3: Fill in your username & password, then uncomment sections below for demo
 */
require __DIR__ . '/vendor/autoload.php';

//Start a new client using cloudcherry account
$client = new \CloudCherry\Client("your-username","your-password"); // Plug-in your credentials here

//Get Settings and Retrive Locations(if any)
//$settings = $client->getSettings();
//echo "Locations Found : ";
//print_r($settings->locations);

//Create Query Filter
$filter = new \CloudCherry\Filter();
$date = new DateTime();
$filter->afterdate =  date(DATE_ISO8601, strtotime('-30 days')); // Last 30 days

//Get Analytics
//$analytics = $client->getAnalyticsByLocation($filter);
//print_r($analytics);

//Get Underlying Responses
//$rawresponses = $client->getAnswers($filter);
//echo count($rawresponses) . "Responses Found ";
//print_r($rawresponses);

//Get Questionnaire Presented
//$questions = $client->getQuestions();
//print_r($questions);

//Add Context by adding Question Tags to each Response
//$contextresponses = $client->getAnswersWithTag($filter);
//print_r($contextresponses);

//Add Context by adding Custom Tags to each Response
//$contextresponses = $client->getAnswersWithTag($filter);
//$customLocationTagLookup = array( "NPS" => "NPSTag1", "Choice2" => "Tag2"); // Build Lookup Array using CSV/JSON
//$customChoiceTagLookup = array( "BLR" => "Bangalore", "SIN" => "Singapore"); // Build Lookup Array using CSV/JSON
//foreach($contextresponses as $answer)
//{
//    if(!empty($answer->locationId && array_key_exists($answer->locationId, $customLocationTagLookup)))
//    { //Add Custom Location Tag
//        $answer->locationTag = $customLocationTagLookup[$answer->locationId];
//    }
//    foreach($answer->responses as $response)
//    { // Add Custom Anwser Choice Tag
//        if(!empty($response->textInput) && array_key_exists($response->textInput,$customChoiceTagLookup))
//            $response->customTag = $customChoiceTagLookup[$response->textInput];
//    }
//}
//print_r($contextresponses);


/* Still got a question or need a sample snippet ready to use ?
 * Checkout API White paper at getcloudcherry.com/api
 * or Ask for Help at support -at- getcloudcherry.com
 */

?>
SSO with Java using Cloud Cherry Java API Client(Jar) :

        String account = "your-main-username";
        String ssokey = "ssokey-set-from-mainuser"; // key set in main account's settings

        APIClient.SSOSubUser subuser = new APIClient.SSOSubUser();
        subuser.userid = "manager"; // SSO user to login/create/modify
        subuser.role = "Manager"; // Manager or ManagerReadOnly
        subuser.email = "validateduser@yourcorp.com";
        subuser.locations = new ArrayList< String >();
        //subuser.locations.add("Downtown"); // Optional Location Restriction for  ManagerReadOnly
        subuser.timeStamp = new Date();

        String signOnURL = APIClient.GenerateSSOUrl(subuser, account, ssokey);
        System.out.println("Redirect/Open From Browser below URL to execute Single SignOn : ");
        System.out.println(signOnURL);
SSO Token Using .NET 4.5+:

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace SingleSignOn
{
    public class CloudCherrySSO
    {
        class SSOSubUser
        {
            public DateTime TimeStamp { get; set; } // UTC TimeStamp
            public string Userid { get; set; } // Unique User
            public string Email { get; set; } // Valid & Verified Email
            public string Role { get; set; } // Manager, MangerReadOnly
            public List< string > Locations { get; set; } // Optional
        }

        public void GenerateSSOToken()
        {
            string account = "your-main-username";
            string ssokey = "ssokey-set-from-mainuser"; // key set in main account's settings
            string json = JsonConvert.SerializeObject(
                new SSOSubUser
                {
                    Userid = "manager", // SSO user to login/create/modify
                    Role = "Manager",
                    Email = "validateduser@yourcorp.com",
                    TimeStamp = DateTime.UtcNow
                });

            string token = GetSSOToken(json, account, ssokey);

            string signOnURL = "https://api.getcloudcherry.com/#/login?sso=" + account + "&ssotoken=" + token;

            Console.WriteLine("Redirect/Open From Browser below URL to execute Single SignOn : ");
            Console.WriteLine(signOnURL);
        }

        static string GetSSOToken(string roleuser, string account, string ssokey)
        { 
            //Generate Initial Vector
            string strIV = InitialVector(16);
            //Generate Hashed Key
            HMACSHA256 signer = new HMACSHA256(Encoding.UTF8.GetBytes(account));
            byte[] Key = Encoding.UTF8.GetBytes(Convert.ToBase64String(signer.ComputeHash(Encoding.UTF8.GetBytes(ssokey))).Take(16).ToArray());

            byte[] encrypted = null;
            using (MemoryStream msEncrypt = new MemoryStream())
            using (AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider())
            {
                aesAlg.Mode = CipherMode.CBC;
                aesAlg.Padding = PaddingMode.PKCS7;
                aesAlg.Key = Key;
                aesAlg.IV = Encoding.UTF8.GetBytes(strIV);

                ICryptoTransform encryptor = aesAlg.CreateEncryptor();
                using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
                {
                    byte[] plaintext = Encoding.UTF8.GetBytes(roleuser);
                    csEncrypt.Write(plaintext, 0, plaintext.Length);
                    csEncrypt.FlushFinalBlock();
                }
                encrypted = msEncrypt.ToArray();
            }

            string cryptedtoken = "sso-" + strIV + Convert.ToBase64String(encrypted).Replace("+", "*").Replace("=", "!");
            return HttpUtility.UrlEncode(cryptedtoken);
        }
        static string InitialVector(int maxSize)
        {
            char[] chars = new char[62];
            chars =
            "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
            byte[] data = new byte[1];
            using (RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider())
            {
                crypto.GetNonZeroBytes(data);
                data = new byte[maxSize];
                crypto.GetNonZeroBytes(data);
            }
            StringBuilder result = new StringBuilder(maxSize);
            foreach (byte b in data)
            {
                result.Append(chars[b % (chars.Length)]);
            }
            return result.ToString();
        }

    }
}
SSO Token Using PHP 5+ :

<?php

//Set details
$account = "your-main-username";
$ssokey = "ssokey-set-from-mainuser";

$user = array ( "Userid" => "manager", "Role" => "Manager", "Email" => "validateduser@yourcorp.com",  "TimeStamp" => gmdate("Y-m-d\TH:i:s\Z") );

$data = json_encode($user);

//Generate Initial Vector
$iv = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 16);

//Generate HMAC Key
$key = substr(base64_encode(hash_hmac('sha256', $ssokey, $account, true)),0,16); 

//PKCS7 Padding
$pad = 16 - (strlen($data) % 16);
$paddata = $data . str_repeat(chr($pad), $pad);

//Encrypt
$ciphertext = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $paddata, MCRYPT_MODE_CBC, $iv));
$encryptedtoken = str_replace("=","!",str_replace("+","*", $ciphertext));
$token = urlencode("sso-" . $iv . $encryptedtoken);

echo "Redirect/Open From Browser below URL to execute Single SignOn :\n";
$signOnURL = "https://api.getcloudcherry.com/#/login?sso=" . $account . "&ssotoken=" . $token;
echo $signOnURL. "\n";
?>
Developer Technical Support
Open a Support Ticket by Email : support – at – getcloudcherry.com

What you can do using Cloudcherry with API? Here are the possibilities:

Bring your own front-end(app)

You want a really cool looking front-end app that resonates exactly with the cool factor of your brand? Do you have your own in-house design Guru? Integrate your own front-end with our enterprise analytics platform.

Bring your own channel

Are you pizza hut and want to measure NPS® by the number of times your customer ring a bell in happiness? Get a raspberry pi sit next to bell and accept rings as NPS® point score every time a customer is happy

Bring your own dashboard

Are you looking for a custom-made or a proprietary way to visualize data? – Got a web developer to string together any visualization component to use the API? Well! You have it right there!

Add to your enterprise dashboard

Add a simple button to click-through to CC analytics using SSO (single sign on), your own IT team that manages the rest of the dashboard can do this in one line of code.

Bring your own reports

Need custom reports for your Managers ? Got a Java developer to use iText PDF library to generate beautiful reports tailored for your purpose? There you have it!

Bring your own storage

Paranoid about data security? You can leverage Cloudcherry to source and collect from 6 different channels while using API to store on-premises the data collected and deleted from cloud in one go.

Bring your own real-time responders

Need to fire-fight or open a ticket or track an issue or send a SMS or display it on a info wall? Get your own IT team to write less than a dozen lines to receive notifications programmatically on to your enterprise system for further processing.

The underlying purpose of API to is to be able to replace just replace any piece of the puzzle that you need to customize, while still leveraging the entire picture intact without any effort.