Vonage / vonage-dotnet-sdk

Vonage REST API client for .NET, written in C#. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
https://developer.vonage.com/
Apache License 2.0
106 stars 86 forks source link

sending whatsapp template with video media heading #582

Closed InverMatt closed 3 months ago

InverMatt commented 4 months ago

Hi 👋

I have installed the SDK via visual studio enterprise 2022 nuget.

I can send a WhatsApp template which has a single variable {{1}}, and this works fine.

When attempting to send a template which contains a video in the header element, I receive a 1022 response.

https://developer.vonage.com/en/api/messages-olympus suggests I need to use a WhatsAppCustomRequest object to send a template of this type, but attempting this returns a 1020 error.

Below is an example of the customrequest object I am passing to the vonageClinet.MessagesClient. The information is foo bar to keep details anonymous.

It might be worth noting that the template is in the active status.

Any help on getting this working would be much appreciated.

var requestCustom = new WhatsAppCustomRequest { To = toNumber, From = fromNumber, Custom = new { type = "template", template = new { @namespace = "foo_bar_abcd_1234_asad_12312", name = "video_message", language = new { policy = "deterministic", code = "en" }, components = new object[] { new { type = "header", parameters = new object[] { new { type = "video", video = new { link = "https://my.url.com/video.mp4" //url for video hosted on my domain } } } }, } }

},

};

Tr00d commented 3 months ago

Hi @InverMatt,

Thanks for reaching out and pointing out this problem. Tough to tell what's wrong at first glance. I'll have a look at that later this week, and I'll get back to you.

InverMatt commented 3 months ago

Hi @Tr00d,

thanks for taking the time to reply. I have just yesterday found the issue. It came down to the video file not being in the correct encoding. I was able to diagnose by attempting just sending a standard video message (non-template) which gave a more concise error response.

thanks,

Tr00d commented 3 months ago

@InverMatt,

Well, that's good news :sweat_smile: Happy you figured it out. Let me know if I can be of any help then.

Thanks!