Skip to content

Instantly share code, notes, and snippets.

@mrcnkoba
Last active October 23, 2018 09:41
Show Gist options
  • Save mrcnkoba/3a7d219a42a03f053cc5e93b01ae6d9a to your computer and use it in GitHub Desktop.
Save mrcnkoba/3a7d219a42a03f053cc5e93b01ae6d9a to your computer and use it in GitHub Desktop.
var fetch = require('node-fetch');
var appId = "YOUR_APP_ID";
var secret = "YOUR_SECRET_KEY";
var userId = "3918" // replace with ID of the user from your own database.
var url = `https://api.talkjs.com/v1/${appId}/users/{userId}`;
var body = {
name: "John Doe"
email: ["john@doe.com"]
};
fetch(url, {
method: 'POST',
headers: {
'Authorization' : secret,
'Content-Type': 'application/json'
},
body: JSON.stringify(body) // important to JSON stringify the content
})
.then(x => x.json());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment