Skip to content

ActiveCampaign/example-add_subscriber_send_instant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

ActiveCampaign API script: Add a subscriber and trigger instant autoresponders to send.

Requirements

  1. Our PHP API library
  2. jQuery (it's loaded in the script if you don't use it already)
  3. Familiarity working with PHP code

Installation and Usage

You can install example-add_subscriber_send_instant by downloading (or cloning) the source.

Input your ActiveCampaign URL and API key at the top of the script. Example below:

define("ACTIVECAMPAIGN_URL", "https://youraccount.activehosted.com");
define("ACTIVECAMPAIGN_API_KEY", "8yhuih...768fd56et67");

Make sure the path to the PHP library is correct:

require_once("../../activecampaign-api-php/includes/ActiveCampaign.class.php");

Enter your list ID (which new subscribers will be added to):

$listid = 1;

By default the form looks very basic (to keep it simple):

If you want to include a first and last name in the form, feel free to add new fields. Then in the PHP code, make sure to comment out the default values:

// these values should come across from the form (make sure to name them the same as below)
//$_POST["first_name"] = "";
//$_POST["last_name"] = "";

Optional: If your autoresponder relies on a segment that looks at a custom field value, include any custom field values in the $_POST array:

$_POST["field"] = array("%PERS_1%,0" => "Custom field value");

The custom field value could be part of the HTML form, or hard-coded in your script (where subscribers don't see it).

If you are using Ajax to submit the form, update the URL in the jQuery section:

geturl = $j.ajax({
  url: '', // the URL to this page.

If you don't use Ajax, update the HTML form element to include the URL:

<form id="subscribe_form" method="post" action="URL TO THIS PAGE">

Documentation and Links

Reporting Issues

We'd love to help if you have questions or problems. Report issues using the Github Issue Tracker or email help@activecampaign.com.

About

Add a subscriber and trigger instant responders to send.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages