gabrieldwight / Whatsapp-Business-Cloud-Api-Net

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

Add an option to override WhatsAppBusinessCloudApiConfig for specific messages #32

Closed emisand closed 1 year ago

emisand commented 1 year ago

Currently when using this library with dependency injection we can only use the WABA and Phone Number provided when configuring the service provider.

Our use case requires using different phone numbers for each country we operate with, and it seems that creating a new WhatsAppBusinessClient for each message we send could be inefficient as a service provider is built and a new HttpClient is created for each new instance.

I suggest adding an optional parameter or using a context override to specify a different WhatsAppBusinessCloudApiConfig for each message we send, without the need of creating new WhatsAppBusinessClient instances.

gabrieldwight commented 1 year ago

Hi, I will have a look at your feature request for the multiple phone numbers specified in whatsappbusinesscloudapiconfig to use a single instance I will have free time in the weekend.

If you have a pull request I can have a look and merge it.