messagebird / messagebird-nodejs

The open source Node.js client for MessageBird's REST API
https://www.messagebird.com/developers
105 stars 44 forks source link

Whatsapp media templates not included in typescript HSMContentContent interface #82

Closed marcellox98 closed 3 years ago

marcellox98 commented 3 years ago

Hello,

We are implementing media template in our project. But when I tried to add a components property to a HSMContentContent interface like is described in your documentation it gives a typescript error.

On closer inspection I noticed that there is indeed indeed no components property in the HSMContentContent. When I disable the typescript error the message does send like you expect.

aodinok commented 3 years ago

Hey, @marcellox98, I just created MR, can you please check if it has all fields that you want to use? Also do not hesitate to create MR next time if you see something wrong.

marcellox98 commented 3 years ago

Hi @aodinok, I saw you forgot to add the HSMComponentDocumentParameter and HSMComponentImageParameter to the HSMComponentParameter. Also when I tested it locally I got a typescript error in the normal template code since components should not be mandatory there.

I tried to add an MR with the fixes but is was not authorized

aodinok commented 3 years ago

Thanks for noticing this, I pushed a fix, can you please try again?

By the way, you should be able to fork repo and create PR from there.

marcellox98 commented 3 years ago

I totally forgot i needed to make a PR... There was still an issue that the params property was still mandatory inside the interface which will result in this error "api error(s): Content is not valid for type hsm: hsm params and components can not be set at the same time (code: 21)" when sending a media template

I created a PR that fixes this: https://github.com/messagebird/messagebird-nodejs/pull/84