Email consent GraphQL

Hey guys!

Looking to replace a script that previously used the depreciated acceptsMarketing when creating a customer. Essentially I’d like to create a customer who has given consent to be opted in.

mutation {

customerCreate(

input: {

email: “tes0910@example.com

emailMarketingConsent: {

marketingState: SUBSCRIBED

marketingOptInLevel: SINGLE_OPT_IN

consentUpdatedAt: “2024-10-09T23:49:48Z”

}

}

) {

customer {

id

}

}

}

Customer record is being created, but still not opted in. I’ve tried “PENDING” as well, no luck.

Any ideas or advice would be most appreciated!

What API version are you using? I use essentially the same mutation and it works fine for me.

Are you on 2024-07 or later?

Hi Jay, good point! Was using the latest 2024/10

I removed consentUpdatedAt and it works for me! Had been trying so many things but looks like the date was throwing it off for some reason

Thanks!