Marketing preferences update fails with 406 error code

Hi, I am using shopify-api-node library and trying to update marketing preferences for a customer with

customer.update(id, params)

My params object is like following

{
  email_marketing_consent: {
    state: 'subscribed',
    opt_in_level: 'confirmed_opt_in',
    consent_updated_at: 2022-07-21T08:08:38.679Z,
    consent_collected_from: 'OTHER'
  },
  sms_marketing_consent: {
    state: 'subscribed',
    opt_in_level: 'confirmed_opt_in',
    consent_updated_at: 2022-07-21T08:08:38.679Z,
    consent_collected_from: 'OTHER'
  }
}

May I know what I might be missing?