0

Widget: Automatically Create Organizations (Zendesk Classic)

I have created a widget that will automatically create organizations for you as your agents respond to tickets. It requires you Base64 Encode your API credentials. For example, if your email is "user@domain.com" and password is "password", you would Base64 encode the string "user@domain.com:password"

You can encode your info here: http://ostermiller.org/calc/encode.html - or with any base64 tool you choose.

Once created, simply add this widget to a ticket page.

I hope some of you find this useful.

Eric Dahl

Groupon.com

 

<div id="orgDIV"></div>

<script type="text/javascript">

var str = $j("ul.options li.email a").text();

var substr = str.split('@');

$j.ajax({

'type': 'POST',

'Content-Type': 'application/xml',

'url': 'http://XXXXX.zendesk.com/organizations.xml';, //Change to your Zendesk URL - if your are not XXXXX.zendesk.com, you will need to put your correct URL in place of XXXXX.zendesk.com

'data': '<organization><name>'+ substr[1] +'</name><default>'+ substr[1] +'</default></organization>',

'beforeSend': function(xhr) {

xhr.setRequestHeader("Authentication", "Basic " + "XXXXXXXXXX"); //Insert Base64 Encoded "username:password" here

xhr.setRequestHeader("Content-Type", "application/xml");

},

success: function(response) {

$j("#orgDIV").text("Organization Created");

},

error: function(response) {

$j("#orgDIV").text("Organization Already Exists");

}

});

</script>

 

updated: 2011-12-14

14 comments

Please sign in to leave a comment.