Comments (6)
Maybe you should use createUpdate
instead of create
and don't call deleteByEmail
anymore, so try that and see how it goes.
On another note, Mailwizz does check for dupes, but somehow your request is multiplied at the same time and therefore is too fast for mailwizz to catch it for some reason, i assume mainly because the database check for dupes takes too long. You might wanna look at https://kb.mailwizz.com/articles/performance-improvements/ or try to see why the post request gets multiplied, as mailwizz doesn't do this.
from mailwizz-php-sdk.
Do you have any email verification service enabled ?
from mailwizz-php-sdk.
No.
I did some more testing and I believe I have isolated the reason for the problem.
I am calling the MailWizz API in a POST request and for some reason, the POST request is executed multiple times. The POST request is only called once, but the server executes it multiple times which is why the MailWizz API is adding the same email multiple times. When the MailWizz request is removed from the POST request, the POST request only executes once.
I do not know why MailWizz would cause a POST request to repeat. This seems like a separate issue.
The issue here is that MailWizz adds an email even when it already exists.
My post request:
<?php
if (!empty($_POST)) {
$email = isset($_POST['email']) ? $_POST['email'] : '';
$email = helper::clearText($email);
$email = helper::escapeText($email);
$result = array();
$result = $helper->isEmailExistsInfo($email);
if ($result['error'] !== false)
{
//MailWizz
require_once dirname(__FILE__) . '/mailwizz.init.php';
$endpoint = new MailWizzApi_Endpoint_ListSubscribers();
//Delete user if exists in list so user can be added again.
$endpoint->deleteByEmail('wj730zl99w074', $email);
//App New Users
$response = $endpoint->create('wj730zl99w074', array(
'EMAIL' => $email
));
}
echo json_encode($result);
exit;
}
from mailwizz-php-sdk.
I did some more research and it looks like 90% of the issue is because my client is retrying the POST request due to timeout which is why the POST request is being called multiple times. However, the max number of retries is 1 which means at most, the email should only be added twice.
There are instances where emails have been added 3 times. Could the internal HttpClient used by MailWizz have a retry timeout too? See this StackOverflow for a description of the default behavior of HttpClient: https://stackoverflow.com/questions/23054289/httpclient-executes-requests-multiple-time-if-request-timed-out
Thanks for the help!
from mailwizz-php-sdk.
The client we're using in the code does not do any retry.
from mailwizz-php-sdk.
Ok, good to know. I think I've solved the issue by setting retry to 0 in the client. If I get anymore duplicates, I'll reopen this issue for further investigation. Thanks for the help!
from mailwizz-php-sdk.
Related Issues (20)
- what is URL Hash in tracking campaign ? HOT 3
- where to copy examples files HOT 1
- How to get a campaign's opens/bounces/unsubscribes via API? HOT 1
- How to test it
- Installation HOT 9
- Delete list forbidden HOT 3
- This email address is blacklisted HOT 2
- Changing Class names to customers needs HOT 13
- Add to email blacklist? HOT 1
- API Issue
- Rest API Call Issue HOT 1
- PHP 7.4 warnings
- PHP 7.4 issues HOT 2
- Signature issue HOT 1
- Create API for list segments(Endpoint - MailWizzApi_Endpoint_ListSegments )
- PHP 8.0+ curl_init issue HOT 1
- Reconfirm someone that unsubscribed HOT 1
- Support PHP 7.4+ HOT 1
- request timeout HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mailwizz-php-sdk.