Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Updating SMS Consent

Updating SMS Consent

pikacho
Shopify Partner
3 0 0

I am trying tp update customer SMS consent values using Shopify API 

https://<mystore>.myshopify.com/admin/api/2021-10/customers/<customer id>.json
Method: PUT
Headers: {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Shopify-Access-Token': accessToken}
Body: {'customer': {'sms_marketing_consent': {'state': 'not_subscribed', 'opt_in_level': 'single_opt_in'}}}

 

But getting this error message:

{'status': 400, 'error': 'The json provided is not formatted correctly: Error occurred while parsing request parameters'}

 

Kindly suggest if I am missing something or share me details if you were able to update SMS consent value for a customer using Shopify REST api

 

Reply 1 (1)

AnkitVyas
Shopify Partner
9 0 1

Hello,

 

I have tried with below code and its working.

"sms_marketing_consent": {
  "state": "subscribed",
  "opt_in_level": "single_opt_in",
  "consent_updated_at": "2021-11-30T15:31:06+05:30",
  "consent_collected_from": "OTHER"
}

 

You can try above code.

 

Thank you