WhatsApp / WhatsApp-Nodejs-SDK

The official Meta Business Messaging WhatsApp Cloud API Node.js SDK.
https://whatsapp.github.io/WhatsApp-Nodejs-SDK/
Other
151 stars 74 forks source link

Unexpected key: policystring #21

Closed clivi-kj closed 1 year ago

clivi-kj commented 1 year ago

Expected behavior

I should be able to send a template message.

Current behavior

When i try sending a template message I get this error:

"OAuth \"Facebook Platform\" \"invalid_request\" \"(#100) Unexpected key \\\"policystring\\\" on param \\\"template['language']\\\".\""

Failure information (for bug reporting)

However, policystring seems required: https://github.com/WhatsApp/WhatsApp-Nodejs-SDK/blob/c1b12730e44967f389f96bbe0d8cc1cac9451549/src/types/messages.ts#L320

Steps to Reproduce

Detailed steps to reproduce the issue. Be as detailed as possible without compromising any sensitive data.

const body: MessageTemplateObject<ComponentTypesEnum> =
      {
        name: templateName,
        language:
          {
            policystring: "deterministic",
            code: LanguagesEnum.English_US
          }
      };
      const response = await wa.messages.template(body, toWhatsapp);

Context

Please provide any other relevant information about your application or configuration.

Failure Logs

Please paste any relevant logs here. REMEMBER TO REMOVE ANY/ALL sensitive data (e.g. phone numbers, names, security keys, etc.)!!!

rashedtalukder commented 1 year ago

I saw your PR and greatly appreciate it! Looks like it was just a typo with the name "policystring" see my change request comment: https://github.com/WhatsApp/WhatsApp-Nodejs-SDK/pull/22#pullrequestreview-1380104631