MarcosNicolau / whatsapp-business-sdk

Node.js connector for the WhatsApp Business APIs with TypeScript support, integration tests and more.
MIT License
78 stars 21 forks source link

InteractiveWebhookMessageNfmReplyName is not reachable #49

Open tecoad opened 3 weeks ago

tecoad commented 3 weeks ago

@lukas-becker0,

I just noticed on your recent changes #47 that InteractiveWebhookMessageNfmReplyName is not currently reachable at https://github.com/MarcosNicolau/whatsapp-business-sdk/blob/1a5b276ebc453dcea270d8906cb67f680d77eaba/src/types/webhooks.ts#L49C1-L50C1

export type InteractiveWebhookMessageNfmReplyName =  "address_message" | "flow" | string;

In this change, response_json exists if name is string, however InteractiveWebhookMessageNfmReplyName is not used anywhere. So there is no way to access for example response_json data. Can you revisit your changes?

Regards,

lukas-becker0 commented 3 weeks ago

It is used in the generics of InteractiveWebhookMessageNfmReplyMessage but you are right that the type is broken I forgot to put brackets around the conditional type.

Also based on the previous type response_json should always exist.

lukas-becker0 commented 3 weeks ago

I improved the type for InteractiveWebhookMessageNfmReplyMessage

The PR draft is here: https://github.com/MarcosNicolau/whatsapp-business-sdk/pull/50

Does that fix your issue ?