JacobBennett / SendyPHP

A PHP class built to interface with the Sendy API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible error in change list

ronjo opened this issue · comments

Hi Jake,
I have a problems with your SendyPHPLibrary. I add people to a list, let's call is A. That work fine.
When they later have made some actions on my site I want to add them to another list, B, and unsubscribe them from list A.
That is where I get problems.
I first add them to list B.
Then change to list A, and unsubscribe.

But what happen s that the email get unsubscribed on both list A and B.

Here is the code I use:

// ------ Add to sendy list B ----------------------------------------

$sendy = new SendyLibrary('BBBBBBBB');
$results = $sendy->subscribe(array(
'name'=>$name,
'email'=>$email
));

// ------ Cancel to sendy list A -------------------------------------

$sendy->list_id = "AAAAAAAA";
$results = $sendy->unsubscribe($email);  

//-----------------------------------------------------------------------

Any suggestions?

I posted this as message on SendyForum also.

Kind regards

JR

Hey JR,

I can't think of any reason this would be happening. The unsubscribe function isn't set up to handle multiple requests for a set of lists so I'm not sure that it is actually unsubscribing from both lists.

Can you include the code where you are adding them to list A as well? Is it being done on the same page or somewhere else? Can you confirm that they are in fact being added to list A in that step?

You might also want to try these statements within a try/catch block to see if there are any errors being thrown.

Jacob Bennett skrev 2014-02-07 15:48:

Hey JR,

I can't think of any reason this would be happening. The unsubscribe
function isn't set up to handle multiple requests for a set of lists
so I'm not sure that it is actually unsubscribing from both lists.

Can you include the code where you are adding them to list A as well?
Is it being done on the same page or somewhere else? Can you confirm
that they are in fact being added to list A in that step?

You might also want to try these statements within a try/catch block
to see if there are any errors being thrown.


Reply to this email directly or view it on GitHub
#4 (comment).

Hi again,

Same code to signup to list A, but on another page.
Client sign up on this page to access a test (a series of questions).
That is run on another page. If the does not complete the test, they
stay in list A.
If they complete the test the code example I gave you earlier is executed.

When I look in Sendy database I see both are unsubscribed the exact same
time...

And yes, I can confirm they are added to list A. Also to list B after
running the code example,
but unfortunately marked deleted in both lists.

JR

JR

Thinking this might have something to do with the way Sendy has set up their API. On their documentation one of the parameters for the unsubscribe is the list_id but I know there are instances when they will unsubscribe an e-mail across an entire brand instead of just from a single list. I'm thinking that may be what is happening here but I would need to double check with Ben.

Let me suggest you try this. Try removing the e-mail from list A FIRST! then add it to list B. See if that makes any difference. I have a feeling it might.

I moved the unsubsribe first. Then I checked in the list settings, and
found that unsubscribe all lists was selected for the A list. My fault.

Let us se if it works now ...

I will report a bit later.

Thanks!

JR

Jacob Bennett skrev 2014-02-07 16:52:

JR

Thinking this might have something to do with the way Sendy has set up
their API. On their documentation one of the parameters for the
unsubscribe is the list_id but I know there are instances when they
will unsubscribe an e-mail across an entire brand instead of just from
a single list. I'm thinking that may be what is happening here but I
would need to double check with Ben.

Let me suggest you try this. Try removing the e-mail from list A
FIRST! then add it to list B. See if that makes any difference. I have
a feeling it might.


Reply to this email directly or view it on GitHub
#4 (comment).

JR

Yup, think thats going to solve your problem 😃

Yes, it works now!

All those settings...

JR

Jacob Bennett skrev 2014-02-07 17:25:

JR

Yup, think thats going to solve your problem 😃


Reply to this email directly or view it on GitHub
#4 (comment).