gabrieldwight / Whatsapp-Business-Cloud-Api-Net

This is C# wrapper of whatsapp business cloud api for .NET
MIT License
310 stars 122 forks source link

Suppport for biz_opaque_callback_data #107

Closed sotskopa closed 1 day ago

sotskopa commented 3 days ago

I need a way to track messages based on internal IDs. It is cumbersome to set up a persistent mapping between WhatsApp IDs and internal ones. The Cloud API defines a biz_opaque_callback_data field in the message object, which is propagated as-is in the status webhook, but as far as I can tell, this is not yet supported by the wrapper. It would be very beneficial for me if I could define it on my request objects:

TextMessageRequest textMessageRequest = new TextMessageRequest();
textMessageRequest.To = "Recipient Phone Number";
textMessageRequest.Text = new WhatsAppText();
textMessageRequest.Text.Body = "Message Body";
textMessageRequest.Text.PreviewUrl = false;
textMessageRequest.BizOpaqueCallbackData = "my_custom_id"; // <-- this
var results = await _whatsAppBusinessClient.SendTextMessageAsync(textMessageRequest);

Please let me know what you think!

gabrieldwight commented 2 days ago

hi, i will add support for BizOpaqueCallbackData on all the message objects plus the webhook objects too