/
API Code Examples

API Code Examples

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}`)
    }) 

Related content

API
API
More like this
API FAQ
API FAQ
More like this
Email Message API Methods
Email Message API Methods
Read with this
Import Your Contacts
Import Your Contacts
More like this
Campaign Mailing API Methods
Campaign Mailing API Methods
Read with this
Contacts API Methods
Contacts API Methods
More like this