Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
inter.js
var data = JSON.stringify({
"from": {
"type": "user",
"id": "gnujoow.kim@gmail.com"
},
"body": "Hey"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.intercom.io/messages");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.send(data);
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.