Add Items to a Standard Queue

JQuery Plugin - Feature Testing and Event Tracking

The easiest way to gauge interest in a feature before implementation or add a javascript logger that saves to a remote server. Create a standard queue and replace {queue_name}. Only the queue field is required, all others are optional.


$(document).ready(function () {
	$("button").approvalq({
		queue: "{queue_name}", 					
		subject: "User clicked button", 		
		content: "Details about the action",	
		event: "click",							
		log: true,
		success: mycallback								
	});						
}

function mycallback(response) {
	if (response.success) {
		// response.results.item contains the new object
	}
}				

	

Standard interface for any language

If using Java, Ruby, PHP, Python, Objective C or any other platform, if you can send HTTP requests you can integrate with ApprovalQ.


// Example adding an Item to a queue using Java and the Apache HttpClient.
HttpPost post = new HttpPost("http://approvalq.co/api/item/add");
List postParameters = new ArrayList();
postParameters.add(new BasicNameValuePair("queue", queue));
postParameters.add(new BasicNameValuePair("subject", subject));
postParameters.add(new BasicNameValuePair("content", content));
post.setEntity(new UrlEncodedFormEntity(postParameters));
HttpClient client = HttpClients.createDefault();
client.execute(post);	

	

Receive Real-Time updates

Standard interface for any language

If using Java, Ruby, PHP, Python, Objective C or any other platform, if you can parse JSON objects you can receive real-time status updates from ApprovalQ.


// Example converting a JSON object to a Hashmap using Java and the Jackson library. 
StringBuffer jb = new StringBuffer();
String line = null;
BufferedReader reader = request.getReader();
while ((line = reader.readLine()) != null) 
	jb.append(line);
ObjectMapper mapper = new ObjectMapper();
Map<String, String> map = mapper.readValue(jb.toString(), new TypeReference<Map<String, String>>(){});

Configuring a real-time web hook is very simple, log in to your account and select your queue, at the bottom right click on the "Show Settings" link and the "Workflow" button.

This screen is used to configure status transitions and post status change actions. An action can be either an email or a JSON object sent to your webservice. Paste the email address or API endpoint in the text field.


// Example JSON Object
{  
"qid" : "Queue-Name",  
"itemId" : 13464,  
"step" : 2,  
"orderNum" : 1,  
"originalFrom" : null,  
"subject" : "Welcome!",  
"created" : 1462893254000,  
"updated" : 1462894501239,  
"htmlDecrypt" : null,  
"contentDecrypt" : "Your first queue item."
}