Git Product home page Git Product logo

activecampaign-api-nodejs's People

Contributors

bartboy011 avatar c0bra avatar cojamac avatar cristiangrama avatar lks128 avatar molinto avatar mthommes avatar rpalladino avatar selipso avatar svenstm avatar sylc avatar ziedmahdi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

activecampaign-api-nodejs's Issues

Editing a contact

When editing a contact, lists are mandatory (field p[123]) is there an easy way to edit the contact and keeping its current lists?

Does the the param returned ''listslist" returns all the lits separated by a dash? ( listslist: '1-2' )

On p[123] description there's a warning I don't quite get. WARNING: if overwrite = 1 (which is the default) this call will silently UNSUBSCRIBE this contact from any lists not included in this parameter.

Does that mean I can maybe do something p[1] = listslist to achieve what I need to?

Basic docs for this?

I am trying to get a list of contacts from AC.

var contact_list = ac.api("contact/list", {}); contact_list.then(function(result) { // successful request console.log(result); }, function(result) { // request error });

This returns nothing even though contacts are associated with the account.

{ result_code: 0, result_message: 'Failed: Nothing is returned', result_output: 'json', success: 0, error: 'Failed: Nothing is returned' }

How do I use this to return results?

[FEATURE REQUEST] Migration AC A ENV TO AC B ENV - New service || Enable apis to public

Hi all,

Thanks in advance for taking time and reading my proposal.

Main issue: AC does not migrate accounts on AC from A(ENV) to B(ENV) both inside active campaign, imagine for example replicating, cloning the test platform to production and the opposite even though it would have less sense.

We are developing a script to make this migration but we have serious trouble, some entities that were created in A, can't be created in B because they miss fields, even though they exist like that in A, B can't create them. Does no seem to be very consistent.
Also, there's no way we can force the forms, lists or entities to have a specific ID. Our issue is that we would need to keep the IDS and keys too after migration.

First problem I found, FORMS POST even though its not documented I could access it but can't set the ID we need to set. After using it its impossible to force the IDS. From the architectural perspective I think i t has a lot more sense to generate a more robust Id not just an integer and also letting users define a unique key value( we could use to search as the ID now)

My feature request would be: Exporting all env info a JSON, Importing env from a JSON.
If thats not possible, i'd say at least adding an option in PUT requests to allow users to set custom identifier for whatever they are creating.

GHSA-p8p7-x288-28g6

This library depends on the Request library which has been deprecated for two years. There is an advisory on that library that will likely not be fixed. Is there a mitigation plan for this library to address the issue and move off of Request?

GHSA-p8p7-x288-28g6

[BUG] Wrong error handling when 503 error message is received from ActiveCampaign API.

When activeCampaign load balancer returns a 503 error message. The NodeJS package is not able to parse or generate the response and returns the string "Error:", instead of "Error: ${error.message}" or something like that.

Expected behavior:

  1. Returning the Error object
  2. Return descriptive Error message for cases like those.

Current Behavior:

  1. Returns an empty string as error
  2. Try catch returns a string as an error, instead of an error object.

Array of tags

When I pass an array for tags the result is a little messed up. Am I using this correctly?

screen shot 2016-04-14 at 9 05 35 pm

var data = {
  email: this._user.email,
  tags: ['foo','bar']
}
ac.api('contact/tag_add', data).then(function (result) {
  console.log("DEBUG: success", result)
}, function (result) {
  console.log("DEBUG: error", result)
})

Problem with connector url

I have a problem with how the url is built, after I log an event with api('tracking/log'), the connector url changes to "https://trackcmp.net/event", making all the other api calls imposible to reach after that.

I keep getting this error with all calls as if i was trying to log an event:
{"success":0,"message":"An account ID must be provided."}

Is there a way to reset the connector to the original url? Am I missing something?

Cheers

after contact added successfully in active campaign send welcome email to that contact into nodejs

var mailUrl = new ActiveCampaign(
"https://URL.api-us1.com",
"KEY"
);
var contact = {
email: "[email protected]",
first_name: "john",
last_name: "deo",
phone: 7878787788,
};
var contact_add = mailUrl.api("contact/add", contact);
contact_add.then(
function (result) {
console.log("success result", result);
},
function (result) {
console.log("fail result", result);
}
);

// after contact added successfully in active campaign send welcome email to that contact

add contact

Hi I am tring to add contact, added successfully but firstName and lastName is not showing as full name.
Please also let me know how I can add contact in list?
Please help.

Is this fully functional ?

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

Ids all is no longer working

var contacts_get = ac.api("contact/list?ids=all", {}); contacts_get.then(function(result) { // successful request console.log("result is ", result); }, function(result) { // request error });

Ids all is no longer working, this returns an empty object.

contact/add does not trigger automation event

Hi, I have used the API to add a contact to a list. There is an automation on my account that should trigger once a contact subscribes to a specific list. However, when the user is added through the API, the contact does not automatically get added to the automation. It seems like I have to make another request to add the contact to that automation. This can cause an application to easily reach the 5 req/s cap if more than two users sign up simultaneously.

Error Handing

I wrote a code snippet that transfers a contact from one list to the other if they exist in the system. If they don't exist, it creates a new contact and adds them to the system. This code snippet doesn't work though.

var contact_exists = ac.api("contact/[email protected]", {}, function(response){
  var contact;
  if(response){
    if(response.lists[30]){     //If subscriner is already subscribed, does nothing
      return;
    }
    contact = {
      email: response.email,
      'p[123]': 30,                                       //adds subscriber to list
      'status[123]': 1,
    };
    if(response.first_name){  
      contact.first_name = response.first_name;
    }
    if(response.last_name){
      contact.last_name = response.last_name;
    }
    if(response.fields[4]){
      contact.fields[28, 0] = response.fields[4].val;     //adds field name if available
    }

    var contact_delete = ac.api('contact/delete', {'id': response.id}, function(nestedresponse){
      console.log(nestedresponse);
    });
  }

// If contact is not in the list, the following blocks of code should still execute, but they don't  

  contact.email = "[email protected]";
  contact.p[123] = 30;
  contact.status[123] = 1;

  // Add the contact to the subscribed list

  var contact_add = ac.api("contact/add", contact, function(response){
    console.log(response);
  });
});

Invalid instance in docs

In the readme, you have:

new ActiveCampaign("https://ACCOUNT.api-us1.com", {{KEY}});

In ES6, {KEY} is equivalent to { KEY: KEY }, which would lead me to believe that the right way to create a new instance would be something like:

const ac = new ActiveCampaign('https://account.api-us1.com', {
    KEY: 'some key',
});

When instead, it's actually:

const ac = new ActiveCampaign('https://account.api-us1.com', 'some key');

I get an XML error telling me I am not authorized

I am attempting to do contact/sync.

try {
  const data = {
    email: form_data.email,
    ip4: ctx.request.ip,
    form: form_id,
    api_output: 'json'
    // some more fields...
  }
  // In my app, the ctx.acApi is equal to ActiveCampaign.api
  const acRequest = await ctx.acApi(`contact/sync`, data)
  // do some things with response, irrelevant to this issue
} catch (error) {
  console.error(error)
}

And as a response I get (in XML, I might add, not in the requested JSON format):

<?xml version='1.0' encoding='utf-8'?>
<root><error>You are not authorized to access this file</error></root>

Earlier in the app (when it boots) I run this:

const authCheck = await ctx.acApi.credentials_test() // this has a success: true

Could you tell me what is going wrong here?

Add note_add and others to whitelist

Hi,

I've had to manually add note_add to my whitelist in the Contact.js file. Can't see a way of providing my own whitelist.

It's missing the other note actions as well as automation_list.

Cheers,
Q

Send email to one user (campaign_send)

Hi, I want to be able to send a mail to a particular user. I tried to use this API but it returns this response:

{
    "result_code": 0,
    "result_message": "Please send this campaign through the web interface to continue.",
    "result_output": "json"
}

Not found moduleTAGS

I got error [NOT FOUND MODULE] while sending request to "tags/list" url via your wrap. There are no Tags.js in lib folder.

Unable to parse errors

Lately when I've been trying to query Active Campaign's api, it has been returning what looks like an out of service message:

<div align="center" style="font-size:12px; font-family:Arial;">We are currently having some issues. Please check back soon.</div>

However, it looks like the node wrapper attempts to JSON.parse() this response, and this causes the script to crash.

Here is the relevant stack trace:

<div align="center" style="font-size:12px; font-family:Arial;">We are currently having some issues.  Please check back soon.</div>
^

SyntaxError: Unexpected token <
    at Object.parse (native)
    at Request._callback (/Users/eahenke/github/integrator/node_modules/activecampaign/lib/Connector.js:190:35)
    at Request.self.callback (/Users/eahenke/github/integrator/node_modules/activecampaign/node_modules/request/request.js:200:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/Users/eahenke/github/integrator/node_modules/activecampaign/node_modules/request/request.js:1067:10)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/Users/eahenke/github/integrator/node_modules/activecampaign/node_modules/request/request.js:988:12)
    at Object.forward (/usr/local/lib/node_modules/strongloop/node_modules/strong-agent/lib/proxy.js:79:23)
    at IncomingMessage.eval (eval at wrap (/usr/local/lib/node_modules/strongloop/node_modules/strong-agent/lib/proxy.js:201:20), <anonymous>:3:21)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:905:12)
    at /Users/eahenke/github/integrator/node_modules/loopback/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31
    at nextTickCallbackWith2Args (node.js:441:9)
    at process._tickDomainCallback (node.js:396:17)
    at process.fallback (/Users/eahenke/github/integrator/node_modules/loopback/node_modules/continuation-local-storage/node_modules/async-listener/index.js:450:15)```

Can't add tags

This code fires a Invalid API method error:

        var eventdata = {
            tag: 'somesampletag',
            email: '[email protected]'
        };

        ac.api('contact/tag/add', eventdata).then(function(result) {
            console.log('success', result);
        }, function(result) {
            console.log('failure', redirect);
        });     

the contact has been created earlier by calling ac.api('contact/add').

Cannot retrieve contacts by listid

Hello, I can't seem to retrieve contacts by listid. Here's my code

var contacts_get = ac.api("contact/list?listid=1", {});
        contacts_get.then(function(result) {
            // successful request
            console.log("result is ", result);
        }, function(result) {
            // request error
        });

However, if I change the request contact/list?ids=all I get all contacts. I've also tried contact/list?ids=all&listid=1 but that returns all contacts, even those not part of the listid. Is this a bug or am I missing something? Thanks.

Single sign on not working

Hi,
I wanted to try to single sign on but whenever i tried i get session expired message.

This is the error which comes on url.

https://kamrantestcompany.activehosted.com/admin/index.php?error_mesg=timeout&redir=aHR0cHM6Ly9rYW1yYW50ZXN0Y29tcGFueS5hY3RpdmVob3N0ZWQuY29tL2FkbWluL21haW4ucGhwP19zc290PTExZDEyYTFlYWE1NmVkZmJmOGRjYzVjYjQ1ODI5YWQ5

Not sure what does it mean. I want to figure this out if you could help me.

Using code from this link

Unable to GET all contacts using contact_list

Here is the code I wrote so far:

var contact_list = ac.api("contact/list", {}, function(response) {
  console.log(response);
});

This is the error it gives:

/Users/Thakkery/Sites/omninox-local/node_modules/activecampaign/lib/ActiveCampaign.js:71
                throw new Error("Invalid API method.");
                      ^
Error: Invalid API method.
    at Object.api (/Users/Thakkery/Sites/omninox-local/node_modules/activecampaign/lib/ActiveCampaign.js:71:11)

Release 1.2.2

Thanks for merging my pull request #24. Could you please create a new release on npm with this bug fix?

Cannot find module when using in meteor.js

I have installed and tested the packed in meteor.js locally and is working fine.

After deploying to a staging server I get the following error..

/bundle/programs/server/node_modules/fibers/future.js:280
throw(ex);
^
Error: Cannot find module '/node_modules/activeCampaign/lib/Connector'
at require (packages/modules-runtime.js:123:19)
at meteorInstall.node_modules.activeCampaign.lib.ActiveCampaign.js (packages/modules.js:985:17)

API v3 Support

This looks like it supports your API v1. Do you have a library which supports v3?

Contact Add Action not working

Hello Sir,
I using this wrapper for a long time & it's working properly until last 2 days.Even I try to used API but it isn't working now.Can you please checkout once.

Not a JSON Object

I'm able to make API call's to the api but when there is a error response, it's not in a JSON format. Could we update the API to return in a JSON error format?

The exception isn't helpful as I don't know the reason for the error in the first place.

var api_request = new RSVP.Promise(function(fulfill, reject) { request(request_options, function(error, response, body) { try { JSON.parse(body); } catch (e) { reject("Not a valid JSON object.") return; }

Superfluous empty objects

Calling any API function requires an empty object be passed, e.g:

var account_view = ac.api("account/view", {}); // <-- {} needed, even without options

It would be far cleaner if on this line you had a default prop:

api: function(path, post_data = {})

... which would mean the api call could simply be:

ac.api("account/view");

... in the absence of options.

CORS problem

Hi,

I do a GET request on my Vuejs app (localhost:8080) and have some CORS problems :
"Access to fetch at 'my_url/admin/api.php?api_key=my_key&api_action=contact_view_email&api_output=json&email=[email protected]' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."

I have the same problem when I use a simple fetch instead of your library.

How can I manage CORS?

Thanks for your help

Adding contact to List

Hello,

I'm trying to add new members to my contacts and a specific mailing list, however all the examples I could find were for PHP.
So I tried to structure it the same way as Lists are gotten from a GET request, I didn't get an error, but no success adding the user to the list:

this is what I've been trying:

var lists = {'5': 5};
            var status = {'5': 1};
            var contact = {
                email: user.email
                ,p: lists
                ,status: status
            };

// Add contact
            var post_test = ac.api("contact/add", contact).then(function (result) {
                // successful request
                console.log(result);
            }, function (result) {
                console.log("ERROR",result);
                // request error
            });

I'd appreciate any help or pointers in the right direction, Thanks!

This repo is outdated and abandoned

Current version of ActiveCampaign API is NOT supported by this package and there is no info about this in docs. Do not use it in your project!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.