Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Table of Contents:

Code Examples

Add contact to List: PHP, C# and NodeJS examples

C# code example of how to add a contact to your Ongage List:

PHP code example of how to add a single contact to your Ongage List:

NodeJS code example of how to add a single contact to your Ongage List

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}`)
    }) 
  • No labels