Skip to content

Display Mailchimp self hosted sign up form if an unsubscribed contact tries to resubscribe with "Update Existing Subscriber?" enabled #117

@MaxwellGarceau

Description

@MaxwellGarceau

Is your enhancement related to a problem? Please describe.

Started on #93

Background

If a contact unsubscribes and then wants to resubscribe they have to do it through the Mailchimp hosted sign up form. They can't be resubscribed through the API. This is intended Mailchimp behavior.

Currently, we display a generic "Please enter a valid email" error if an unsubscribed contact wants to resubscribe. We're getting this error from Mailchimp's validation through the API.

Response from Mailchimp
wordpress-1  | [Tue Dec 24 19:04:44.609083 2024] [php:notice] [pid 25:tid 25] [client 172.18.0.1:55426] args, referer: http://localhost:8888/?p=8
wordpress-1  | [Tue Dec 24 19:04:44.609175 2024] [php:notice] [pid 25:tid 25] [client 172.18.0.1:55426] Array
(
    [method] => PUT
    [timeout] => 10
    [redirection] => 5
    [httpversion] => 1.1
    [user-agent] => Mailchimp WordPress Plugin/http://localhost:8888
    [headers] => Array
        (
            [Authorization] => Bearer 9cf7be3c9d2e49209d623f72adeb7b00
        )
    [body] => {"email_address":"maxwellgarceau+subscribeconfirmation@gmail.com","email_type":"html","merge_fields":{},"interests":{},"status":"subscribed"}
), referer: http://localhost:8888/?p=8

wordpress-1  | [Tue Dec 24 19:04:44.609186 2024] [php:notice] [pid 25:tid 25] [client 172.18.0.1:55426] url, referer: http://localhost:8888/?p=8
wordpress-1  | [Tue Dec 24 19:04:44.609190 2024] [php:notice] [pid 25:tid 25] [client 172.18.0.1:55426] https://us19.api.mailchimp.com/3.0/lists/3dc5a6c6c8/members/d4ba8092058018001923a6911cb5a04e, referer: http://localhost:8888/?p=8

⠧ wordpress-1  | [Tue Dec 24 19:04:44.853261 2024] [php:notice] [pid 25:tid 25] [client 172.18.0.1:55426] request, referer: http://localhost:8888/?p=8
wordpress-1  | [Tue Dec 24 19:04:44.853379 2024] [php:notice] [pid 25:tid 25] [client 172.18.0.1:55426] Array
(
    [headers] => WpOrg\Requests\Utility\CaseInsensitiveDictionary Object
        (
            [data:protected] => Array
                (
                    [content-type] => application/problem+json; charset=utf-8
                    [content-length] => 206
                    [x-spanid] => 018ea980-1ddf-fd9d-f710-1d3da1abbe17
                    [x-amzn-trace-id] => Root=1-676b05cc-40a99229482333653d21eb5f
                    [content-encoding] => gzip
                    [x-content-type-options] => nosniff
                    [link] => <https://us19.api.mailchimp.com/schema/3.0/Definitions/ProblemDetailDocument.json>; rel="describedBy"
                    [server] => istio-envoy
                    [vary] => Accept-Encoding
                    [x-envoy-upstream-service-time] => 104
                    [x-envoy-decorator-operation] => http-interposer-desired-service.mailchimp-cloud-httpinterposer-use2-prd-m2.svc.cluster.local:8090/*
                    [strict-transport-security] => max-age=31536000
                    [intuit_tid] => 1-676b05cc-40a99229482333653d21eb5f
                    [x-request-id] => 1-676b05cc-40a99229482333653d21eb5f
                    [date] => Tue, 24 Dec 2024 19:04:44 GMT
                )
        )
    [body] => {"title":"Member In Compliance State","status":400,"detail":"maxwellgarceau+subscribeconfirmation@gmail.com is in a compliance state due to unsubscribe, bounce, or compliance review and cannot be subscribed.","instance":"43ec3596-e49c-7e87-5afb-4549081af428"}
    [response] => Array
        (
            [code] => 400
            [message] => Bad Request
        )
), referer: http://localhost:8888/?p=8

wordpress-1  | [Tue Dec 24 19:04:44.853438 2024] [php:notice] [pid 25:tid 25] [client 172.18.0.1:55426] body, referer: http://localhost:8888/?p=8
wordpress-1  | [Tue Dec 24 19:04:44.853499 2024] [php:notice] [pid 25:tid 25] [client 172.18.0.1:55426] Array
(
    [title] => Member In Compliance State
    [status] => 400
    [detail] => maxwellgarceau+subscribeconfirmation@gmail.com is in a compliance state due to unsubscribe, bounce, or compliance review and cannot be subscribed.
    [instance] => 43ec3596-e49c-7e87-5afb-4549081af428
), referer: http://localhost:8888/?p=8
subscriber-can-not-resubscribe-walkthrough.mov

Designs

If an unsubscribed contact tries to resubscribe with "Update Existing Subscriber?" enabled we can fetch the Mailchimp sign up form URL through the API for the list they want to subscribe to and then return the link to the FE where they can sign up on the Mailchimp self hosted form.

Mailchimp Sign Up Forms API documentation: /lists/{list_id}/signup-forms

I believe this would create a stronger integration between Mailchimp WP and the Mailchimp account. In addition, user's would understand more clearly what was happening.

Describe alternatives you've considered

Alternatively, we could update the error message so that a user understands why their form submission continues to fail.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions