const request = require('request-promise-native')const headers = {
x_username: '*******',
x_password:'********',
x_account_code:'*********'
}
const listId = 1234 // Put List Id in which you want to create contact
const createContact = async () => {
const payload = {
uri: `https://api.ongage.net/${listId}/api/v2/contacts/`,
json: true,
body: {
email: 'test123@gmail.com',
first_name: 'Test',
last_name: 'Test'
},
headers,
method: "POST",
resolveWithFullResponse: true
}
return request(payload)
}createContact()
.then((response) => {
console.log(`Response : ${JSON.stringify(response)}`)
}).catch((err) => {
console.log(`Error : ${err}`)
})