Brian Hazel
New Member
Hello,
I've read through multiple forum posts of adding a subscriber via API, but I believe there is a small part I'm missing that's not adding the subscriber to the list.
On the capture form I have the subscriber input their email -
<form onsubmit="" action="" method="post" accept-charset="utf-8">
<div class="form-group">
<label>Email <span class="required">*</span></label>
<input data-sync="input-81592" class="form-control" name="EMAIL" placeholder="" value="" required="" type="text">
</div>
</form>
Then the funnel(ClickFunnels) sends the subscriber email via a Webhook to my MailWizz Webhook URL using Zapier in the JSON Format.
<?php
require_once dirname(__FILE__) . '/setup.php';
if (!empty($_POST)) {
$listUid = '[LIST_UNIQUE_ID]';// you'll take this from your customers area, in list overview from the address bar.
$endpoint = new MailWizzApi_Endpoint_ListSubscribers();
$response = $endpoint->create($listUid, array(
'EMAIL' => isset($_POST['EMAIL']) ? $_POST['EMAIL'] : null,
));
$response = $response->body;
// if the returned status is success, we are done.
if ($response->itemAt('status') == 'success') {
exit(MailWizzApi_Json::encode(array(
'status' => 'success',
'message' => 'Thank you for joining our email list. Please confirm your email address now!'
)));
}
// otherwise, the status is error
exit(MailWizzApi_Json::encode(array(
'status' => 'error',
'message' => $response->itemAt('error')
)));
}
?>
I've configured the setup.php also. But in the end, the subscriber is not added.
I've read through multiple forum posts of adding a subscriber via API, but I believe there is a small part I'm missing that's not adding the subscriber to the list.
On the capture form I have the subscriber input their email -
<form onsubmit="" action="" method="post" accept-charset="utf-8">
<div class="form-group">
<label>Email <span class="required">*</span></label>
<input data-sync="input-81592" class="form-control" name="EMAIL" placeholder="" value="" required="" type="text">
</div>
</form>
Then the funnel(ClickFunnels) sends the subscriber email via a Webhook to my MailWizz Webhook URL using Zapier in the JSON Format.
<?php
require_once dirname(__FILE__) . '/setup.php';
if (!empty($_POST)) {
$listUid = '[LIST_UNIQUE_ID]';// you'll take this from your customers area, in list overview from the address bar.
$endpoint = new MailWizzApi_Endpoint_ListSubscribers();
$response = $endpoint->create($listUid, array(
'EMAIL' => isset($_POST['EMAIL']) ? $_POST['EMAIL'] : null,
));
$response = $response->body;
// if the returned status is success, we are done.
if ($response->itemAt('status') == 'success') {
exit(MailWizzApi_Json::encode(array(
'status' => 'success',
'message' => 'Thank you for joining our email list. Please confirm your email address now!'
)));
}
// otherwise, the status is error
exit(MailWizzApi_Json::encode(array(
'status' => 'error',
'message' => $response->itemAt('error')
)));
}
?>
I've configured the setup.php also. But in the end, the subscriber is not added.