ActiveCampaign Forum

Add contact to automation via nodejs API


Hi there,

I’m trying to use the NodeJS API to add a contact to an automation.

How am I supposed to do this.

I’ve tried to different npm libraries, with no luck. Please help.

Also, how do i find the id of my automation, and how do I pass the automation id to the api?

Here is the code of the 2 attempts:

a) npm library “activecampaign”

var ActiveCampaign = require(“activecampaign”);
var ac = new ActiveCampaign(process.env.AC_ACCT_NAME, process.env.AC_API_KEY);

var theContact = ac.api(“automation_contact_add”, {email:});
theContact.then(function(result) {
// successful request
}, function(result) {
// request error

b) npm library “activecampaign-api”

const activeCampaignApi = require(‘activecampaign-api’);
// Instantiate a new client.
const activeCampaignApiClient = new activeCampaignApi.ApiClient({
// Pass your account name and secret key
accountName: process.env.AC_ACCT_NAME,
key: process.env.AC_API_KEY

.call(‘contact_add’, {}, ‘POST’, {
.then(response => {
// Handle the response…
res.json({success: true});