ActiveCampaign / activecampaign-api-nodejs

Node.js wrapper for the ActiveCampaign API
MIT License
39 stars 36 forks source link

Is this fully functional ? #32

Closed Vivek2s closed 6 years ago

Vivek2s commented 7 years ago

I want to get all list & also want to view the contact.So I'm using this code: ac.api("list/view",{}); output : "result_code": 0, "result_message": "Failed: Nothing is returned", "result_output": "json", "success": 0, "error": "Failed: Nothing is returned"

Could you please tell me how can I make the request for getting all List & add contact in the List by using this wrapper

mthommes commented 7 years ago

Hi, please try the following:



var ac = new ActiveCampaign("API URL", "API KEY");
ac.debug = true;

// Get lists
var lists = ac.api("list/list?ids=all", {}).then(function(result) {
    console.log(result);
});

// Add contact
var post_test = ac.api("contact/add", {
    email: 'nodetest@test.com'
}).then(function(result) {
    // successful request
    console.log(result);
}, function(result) {
    // request error
});