Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resubscribe functionality via API #20

Merged
merged 14 commits into from
May 22, 2024
Merged

resubscribe functionality via API #20

merged 14 commits into from
May 22, 2024

Conversation

andreibaca
Copy link
Contributor

If the user is unsubscribed Zoho allows only resubscription via form.
The subscription response returns true for success but the message is "Contact belongs to Do-not-mail registry." and user does not receive any confirmation emails and is not subscribed again.

To allow re-subscription a specific parameter has to be added to the request url
donotmail_resub=true

With this parameter the response message is the following
"This is a Donotmail contact or removed contact,So the resubscribtion email is sent to the user. User needs to confirm to successfully subscribe."
And user receives a resubscription confirmation email.

With this pull request resubscribe method is added that works.

@cappuc
Copy link
Contributor

cappuc commented May 13, 2024

Hi @andreibaca

Do you think it makes sense to always add the donotmail_resub=true parameter to the subscribe request?

If the subscribe response is successful even if the user is not actually subscribed, you have to check the message and then call the resubscribe method and this is not so intuitive.

If always adding the parameter is not a problem, I think that is better to add it to the subscribe request so it can handle both cases

@andreibaca
Copy link
Contributor Author

andreibaca commented May 14, 2024

I think it's better to offer more choice and document it. If someone wants to use donotmail_resub he can just use the resubscribe function instead of subscribe. I am not sure what problems could arise if we use this parameters for subscribe all the time since it is not documented, and could even change in the future which could result in errors.
We can just add a parameter to the subscribe method to allow resubscription when necessary.
Maybe even include the $optional_parameters in subscribe.

@andreibaca
Copy link
Contributor Author

Actually I will test if it's ok to use resubscribe for new users.

@andreibaca
Copy link
Contributor Author

andreibaca commented May 14, 2024

It seems to simply work for new users when using donotmail_resub=true. May be I overengineered it. Just did not want to mess with existing functionality to make it backwards compatible.. :)
But I would still add the optional parameters for any future cases. It just makes the library more flexible.

@andreibaca
Copy link
Contributor Author

I just thought of a case where the developer might want to confirm that the user really wants to resubscribe then we need 2 separate methods.

@andreibaca
Copy link
Contributor Author

andreibaca commented May 17, 2024

I have added some more functionality to get the list of subscribers and to count them.
I forgot to create a new branch so it's in the same pull request. Sorry for confusion and inconvenience.
I have already tested it with a live zoho account and it works as expected.

@cappuc
Copy link
Contributor

cappuc commented May 17, 2024

No problem!

Next week I'll review the changes and merge it.

@cappuc cappuc merged commit 0b2f7c3 into keepsuit:main May 22, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants