eloqua-api
v1.0.1
Published
A node module packing useful Eloqua API functions
Maintainers
Readme
Eloqua Node API Helper
Table of contents
Getting Started
To start using the functions, require the module and initiate a new Eloqua
const ELQ = require('eloqua-api');
const eloqua = new ELQ(pod, site, username, password);For the pod, please use the full designation (with the p) like this : p06
Accounts
Functions
createAccounts
eloqua.createAccounts(data, callback);data: array. This is an array composed of objects containing information of the accounts willing to be created.callback: function. The callback function. Takes one parameter,res, which is the data returned by the query.
Example request:
let data = [{name: "ACME Group", address1: "123 Fake Str."}, {name: "DIST Corp", address1: "42 Unif Bvd."}];
eloqua.createAccounts(data, function(res) {
console.log(res);
})The response in the callback is an array containing the information of the created accounts.
Example response:
[{ type: 'Account',
id: '1382',
createdAt: '1543784368',
depth: 'complete',
description: '',
name: 'ACME Group',
updatedAt: '1543784368',
address1: '123 Fake Str.',
address2: '',
address3: '',
businessPhone: '',
city: '',
country: '',
fieldValues: [],
postalCode: '',
province: '' },
{...}]getAccounts
eloqua.getAccounts(ids, callback);ids: array. An array containing integers that represent the IDs of the accounts in Eloqua.callback: function. The callback function. Takes one parameter,res, which is the data returned by the query.
Example request:
const ids = [1382, 1384];
eloqua.createAccount(ids, function(res) {
console.log(res);
})The response in the callback is an array containing the information of the accounts.
Example response:
[{ type: 'Account',
id: '1382',
createdAt: '1543784368',
depth: 'complete',
description: '',
name: 'ACME Group',
updatedAt: '1543784368',
address1: '123 Fake Str.',
address2: '',
address3: '',
businessPhone: '',
city: '',
country: '',
fieldValues: [],
postalCode: '',
province: '' },
{...}]searchAccounts
eloqua.searchAccounts(criteria, field, complete, callback);criteria: string. The value of the field you want to search on.field: string. The field you want to perform a search on. Enternullif you want to search on the standardCompany Namefield.complete: boolean.trueif you need complete and detailed information about the account,falseif you only need the basic information.callback: function. The callback function. Takes one parameter,res, which is the data returned by the query.
Example request:
eloqua.searchAccounts('ACME*', null, true, function(res) {
console.log(res);
})Example response:
{ elements:
[ { type: 'Account',
id: '1382',
createdAt: '1543784368',
depth: 'complete',
description: '',
name: 'ACME Group',
updatedAt: '1543784368',
address1: '123 Fake Str.',
address2: '',
address3: '',
businessPhone: '',
city: '',
country: '',
fieldValues: [Array],
postalCode: '',
province: '' },
{...} ],
total: 3 }elements: array. This is an array containing the informations from the accountstotal: integer. This is the total number of the elements returned by the request
getAllAccounts
eloqua.getAllAccounts(callback);WARNING
Depending on the size of your Eloqua instance and the number of Accounts it has, using this function can take a lot of time. Be careful when using it.
callback: function. The callback function. Takes one parameter,res, which is the data returned by the query.
Example request:
eloqua.getAllAccounts(function(res) {
console.log(res);
})Example response:
{ elements:
[ { type: 'Account',
id: '1382',
createdAt: '1543784368',
depth: 'complete',
description: '',
name: 'ACME Group',
updatedAt: '1543784368',
address1: '123 Fake Str.',
address2: '',
address3: '',
businessPhone: '',
city: '',
country: '',
fieldValues: [Array],
postalCode: '',
province: '' },
{...} ],
total: 6 }elements: array. This is an array containing the informations from the accountstotal: integer. This is the total number of the elements returned by the request
deleteAccounts
eloqua.deleteAccounts(ids, callback);ids: array. An array containing integers that represent the IDs of the accounts in Eloqua.callback: function. The callback function. Takes no parameter.
Exemple request:
const ids = [1382, 1384];
eloqua.deleteAccounts(ids, function() {
console.log('Deleted');
})Contacts
Functions
createContacts
eloqua.createContacts(data, callback);data: array. This is an array composed of objects containing information of the contacts willing to be created.callback: function. The callback function. Takes one parameter,res, which is the data returned by the query.
Example request:
let data = [{"emailAddress": "[email protected]"}, {"emailAddress": "[email protected]"}];
eloqua.createContacts(data, function(res) {
console.log(res);
})The response in the callback is an array containing the information of the created contacts.
Example response:
[ { type: 'Contact',
currentStatus: 'Awaiting action',
id: '33402',
createdAt: '1543833282',
depth: 'complete',
name: '[email protected]',
updatedAt: '1543833282',
emailAddress: '[email protected]',
emailFormatPreference: 'unspecified',
fieldValues:
[[...]],
isBounceback: 'false',
isSubscribed: 'true',
subscriptionDate: '1543833231' },
{...}]getContacts
eloqua.getContacts(ids, callback);ids: array. An array containing integers that represent the IDs of the contacts in Eloqua.callback: function. The callback function. Takes one parameter,res, which is the data returned by the query.
Example request:
const ids = [33402, 33403];
eloqua.getContacts(ids, function(res) {
console.log(res);
})The response in the callback is an array containing the information of the contacts.
Example response:
[ { type: 'Contact',
currentStatus: 'Awaiting action',
id: '33402',
createdAt: '1543833282',
depth: 'complete',
name: '[email protected]',
updatedAt: '1543833282',
emailAddress: '[email protected]',
emailFormatPreference: 'unspecified',
fieldValues:
[[...]],
isBounceback: 'false',
isSubscribed: 'true',
subscriptionDate: '1543833231' },
{...}]searchContacts
eloqua.searchContacts(criteria, field, complete, callback);criteria: string. The value of the field you want to search on.field: string. The field you want to perform a search on. Enternullif you want to search on the standardemailAddressfield.complete: boolean.trueif you need complete and detailed information about the contact,falseif you only need the basic information.callback: function. The callback function. Takes one parameter,res, which is the data returned by the query.
Example request:
eloqua.searchContacts('[email protected]', null, true, function(res) {
console.log(res);
})Example response:
{ elements:
[ { type: 'Contact',
currentStatus: 'Awaiting action',
id: '33403',
createdAt: '1543834309',
depth: 'complete',
name: '[email protected]',
updatedAt: '1543834309',
emailAddress: '[email protected]',
emailFormatPreference: 'unspecified',
fieldValues: [Array],
isBounceback: 'false',
isSubscribed: 'true',
subscriptionDate: '1543833231' } ],
total: 1 }elements: type: array. This is an array containing the informations from the contactstotal: type: integer. This is the total number of the elements returned by the request
getAllContacts
eloqua.getAllContacts(callback);WARNING
Depending on the size of your Eloqua instance and the number of contacts it has, using this function can take a lot of time. Be careful when using it.
callback: function. The callback function. Takes one parameter,res, which is the data returned by the query.
Example request:
eloqua.getAllContacts(function(res) {
console.log(res);
})Example response:
{ elements:
[ { type: 'Contact',
currentStatus: 'Awaiting action',
id: '33403',
createdAt: '1543834309',
depth: 'complete',
name: '[email protected]',
updatedAt: '1543834309',
emailAddress: '[email protected]',
emailFormatPreference: 'unspecified',
fieldValues: [Array],
isBounceback: 'false',
isSubscribed: 'true',
subscriptionDate: '1543833231' },
{... }],
total: 12322 }elements: array. This is an array containing the informations from the contactstotal: integer. This is the total number of the elements returned by the request
deleteContacts
eloqua.deleteContacts(ids, callback);ids: array. An array containing integers that represent the IDs of the contacts in Eloqua.callback: function. The callback function. Takes no parameter.
Exemple request:
const ids = [33402, 33403];
eloqua.deleteContacts(ids, function() {
console.log('Deleted');
})Custom Objects
WIP
Roadmap
- Custom objects functions
- Import/Export function
License
MIT © Fabio Benoit
