Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents:

Table of Contents
minLevel2

Code Examples

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

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

View file
nameAdd _Contact_to_List.cs
height250

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

View file
nameAdd_Contact_to_List.php
height250

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

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

...