Problem: I need to unsubscribe the Customer on SMS.
Error:
sms_marketing_consent - Cannot set the customer’s sms consentPassed parameter:
[
"accepts_marketing" => false,
"accepts_marketing_updated_at" => $date,
"email_marketing_consent" => [
"state" => "subscribed",
"opt_in_level" => "confirmed_opt_in",
"consent_updated_at" => $date,
],
"phone" => "+642102912345",
"sms_marketing_consent" => [
"state" => "subscribed",
"opt_in_level" => "single_opt_in",
"consent_updated_at" => $date,
"consent_collected_from" => "OTHER",
],
"verified_email" => true,
]
Error is thrown when I change [‘sms_marketing_consent’][‘state’] value from subscribed to not_subscribed.
And setting the whole property [‘sms_marketing_consent’] to null doesn’t also work.
The workaround I found to solve this problem on unsubscribing in SMS is to invoke two(2) endpoints.
- Update the Customer.
[
"phone" => null,
"sms_marketing_consent" => null,
]
Setting the sms_marketing_consent property to null as well as the phone number.
2. Update the Customer.
[
"phone" => "+642102912345",
]
Set the phone number back.
This seems to be working but is there a way to do it in one swoop?