Updating SMS Consent

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)

Shopify Partner
9 0 1



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