Automatically Creating Client Accounts Through Your Website

Email Marketing software resellers receive many benefits including only paying for what they use, free support, free upgrades, ability to rebrand the software, and the ability to remove all references to ActiveCampaign for a complete white label solution.

If you’re a reseller, you may want to promote the software to prospective clients through your website. A good way to do this is to display a sign-up/registration form on your site that allows clients to provide their information, and use the Email Marketing API to create an account for them, which they can start using right away!

Requirements

To use the provided script examples (you can download the entire script here), you will need a web server to host the files, and familiarity with PHP. Also, edit the top of file api_create_client_process.php to include your installation details:

Getting started

Let’s say you run a soccer league, and would like to allow each team to send email newsletters to their players and families.

I’ve created a quick web form that could be used to obtain the necessary information (see file api_create_client.htm):

With this form on your website, you would capture each submission and create a new list, user, and user group within the Email Marketing software, using the API.

Here is how each form field would map to the Email Marketing software:

Form field Email Marketing component
Team name List name, and User Group title
Your name User first and last name
Your email User email
Your password User password

Here is an example of the form when filled out:

When the form is submitted, we can use the Email Marketing API to capture and save all of the details.

Using the API to process the form details

First, let’s create a new list for each “Team name.” Using the list_add API action, we create a new list in the Email Marketing software:

$post = array(
	"name" => $_POST["team"],
	"subscription_notify" => "",
	"unsubscription_notify" => "",
	"to_name" => "Subscriber",
	"carboncopy" => "",
	"stringid" => preg_replace( "/[^a-z0-9]+/", "-", strtolower($_POST["team"]) ),
	"optid" => "1",
	"bounceid[]" => 1,
);

$list_add = api_process("list_add", "post", array(), $post);

Our list is now added to the software:

Next, we add the user group:

$list_id = $list_add["id"];

// ADD GROUP
$post = array(
	"title" => $_POST["team"],
	"descript" => "Group for " . $_POST["team"],
	"lists[]" => $list_id,
	"sendmethods[]" => 1,
	"abuseratio" => 4,
	"req_approval_1st" => 2,
	"req_approval_notify" => "",
);

$group_add = api_process("group_add", "post", array(), $post);

For simplicity, we name the user group the same as the list.

We immediately associate the new list to this group:

Finally, we add the new user, which is immediately associated with the new user group:

$name = explode(" ", $_POST["name"]);
$post = array(
	"username" => $_POST["email"],
	"password" => $_POST["password"],
	"password_r" => $_POST["password"],
	"email" => $_POST["email"],
	"first_name" => $name[0],
	"last_name" => $name[1],
	"group[]" => $group_id,
);

$user_add = api_process("user_add", "post", array(), $post);

Finishing touches

You can add and remove specific API values – this example only uses the required values. One thing that may be useful is the ability to set permissions for the user group. For example, if we include the following parameters in the $post array for group_add, we disallow the ability for this group to delete lists and messages:

$post["pg_list_delete"] = 0;
$post["pg_message_delete"] = 0;

You can find more information on specific API values in our help documentation.

Wrapping up

At this point, the new user can log into the software and start sending email campaigns! Our script provides a simple message confirming their new account:

Let us know if you notice anything that could be improved.

A trial is worth a thousand words.
Get started today, no credit card required.