API - Add contact to automation is not working

Hi all!

I have a sandbox account. I’m using PHP API wrapper. It’s working fine in terms of adding contact to a list etc.

When it comes to adding a contact to automation, I get the response from server that contact was added, but in fact it’s not!

I’ve simplified the script to demo the issue:

define("ACTIVECAMPAIGN_URL", "__url__");
define("ACTIVECAMPAIGN_API_KEY", "__key__");
require_once("includes/ActiveCampaign.class.php");
$ac = new ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY);

$auto = array(
	"contact_id" => 11,
	"automation" => 2
);
$res = $ac->api("automation/contact/add", $auto);
$success = $res->success;
$error = $res->error;

print (json_encode(array('success' => $success,'error' => $error,'debug' => $res)));

the server response:

{
 http_code: 200
 result_code: 1
 result_message: "Contact added to automation"
 result_output: "json"
 success: 1
}

When I check the automation 2, there are no contacts added to automation there.
Note: contact ID 11 does exist, Automation 2 does exist.

Any ideas? I would appreciate any help.

Thanks!

What I found so far:

  1. For adding the contact to automation by API the automation must be active.
  2. Contacts are added but you can see them only by pressing “EDIT dropdown / View Contacts”.

The blue counter “Contacts currently in the Automation” is still showing 0 for some reason:

Hello,

You are correct that the Automation must be active before Contacts can be added via the API. Are you still experiencing the issue with the counter not matching the number of Contacts that are actually in the Automation? I was not able to reproduce this issue in my simple tests. One possible reason that I can think of is if the Automation is very quick to complete all of the steps, maybe the Contact is no longer “in” the Automation and that could be why the counter is not reflecting them.

-Matt