Last active
October 23, 2018 09:41
-
-
Save mrcnkoba/3a7d219a42a03f053cc5e93b01ae6d9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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