Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creating a new desk.com email case using Basic Auth from Google Apps Script.
var url = "https://yoursitename.desk.com/api/v2/cases";
var options = {
"method": "post",
"headers": {
"Authorization": "Basic " + Utilities.base64Encode("you@example.com:yourpassword")
},
"payload": {
"type": "email",
"subject": "Email Case Subject",
"priority": 4,
"status": "open",
"labels": [
"Spam",
"Ignore"
],
"message": {
"direction": "in",
"body": "Example body",
"to": "someone@desk.com",
"from": "someone-else@desk.com",
"subject": "My email subject"
},
"_links": {
"customer": {
"class": "customer",
"href": "/api/v2/customers/1"
}
}
}
};
var response = UrlFetchApp.fetch(url, options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.