diff --git a/WhatsappBusiness.CloudApi/Interfaces/IWhatsAppBusinessClient.cs b/WhatsappBusiness.CloudApi/Interfaces/IWhatsAppBusinessClient.cs index 8e0ea1e..f1f3129 100644 --- a/WhatsappBusiness.CloudApi/Interfaces/IWhatsAppBusinessClient.cs +++ b/WhatsappBusiness.CloudApi/Interfaces/IWhatsAppBusinessClient.cs @@ -781,7 +781,79 @@ public interface IWhatsAppBusinessClient /// Cancellation token /// WhatsAppResponse WhatsAppResponse SendMPMTemplate(MultiProductTemplateMessageRequest multiProductTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default); - #endregion + + /// + /// Send Catalog Template Message + /// + /// CatalogTemplateMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + Task SendCatalogMessageTemplateAsync(CatalogTemplateMessageRequest catalogTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default); + + /// + /// Send Catalog Template Message + /// + /// CatalogTemplateMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + WhatsAppResponse SendCatalogMessageTemplate(CatalogTemplateMessageRequest catalogTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default); + + /// + /// Send Catalog Message + /// + /// CatalogMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + Task SendCatalogMessageAsync(CatalogMessageRequest catalogMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default); + + /// + /// Send Catalog Message + /// + /// CatalogMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + WhatsAppResponse SendCatalogMessage(CatalogMessageRequest catalogMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default); + + /// + /// Send Carousel Template Message + /// + /// CarouselTemplateMessageRequest object + /// Custom WHatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + Task SendCarouselMessageTemplateAsync(CarouselTemplateMessageRequest carouselTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default); + + /// + /// Send Carousel Template Message + /// + /// CarouselTemplateMessageRequest object + /// Custom WHatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + WhatsAppResponse SendCarouselMessageTemplate(CarouselTemplateMessageRequest carouselTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default); + + /// + /// Send Coupon Code Template Message + /// + /// CouponCodeTemplateMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + Task SendCouponCodeMessageTemplateAsync(CouponCodeTemplateMessageRequest couponCodeTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default); + + /// + /// Send Coupon Code Template Message + /// + /// CouponCodeTemplateMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + WhatsAppResponse SendCouponCodeMessageTemplate(CouponCodeTemplateMessageRequest couponCodeTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default); + #endregion #region Two step verification code function /// diff --git a/WhatsappBusiness.CloudApi/WhatsAppBusinessClient.cs b/WhatsappBusiness.CloudApi/WhatsAppBusinessClient.cs index 84e5089..aaa9e8f 100644 --- a/WhatsappBusiness.CloudApi/WhatsAppBusinessClient.cs +++ b/WhatsappBusiness.CloudApi/WhatsAppBusinessClient.cs @@ -1858,6 +1858,150 @@ public WhatsAppResponse SendMPMTemplate(MultiProductTemplateMessageRequest multi return WhatsAppBusinessPostAsync(multiProductTemplateMessageRequest, formattedWhatsAppEndpoint, cancellationToken).GetAwaiter().GetResult(); } + /// + /// Send Catalog Template Message + /// + /// CatalogTemplateMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + public async Task SendCatalogMessageTemplateAsync(CatalogTemplateMessageRequest catalogTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default) + { + if (cloudApiConfig is not null) + { + _whatsAppConfig = cloudApiConfig; + } + + var formattedWhatsAppEndpoint = WhatsAppBusinessRequestEndpoint.SendMessage.Replace("{{Phone-Number-ID}}", _whatsAppConfig.WhatsAppBusinessPhoneNumberId); + return await WhatsAppBusinessPostAsync(catalogTemplateMessageRequest, formattedWhatsAppEndpoint, cancellationToken); + } + + /// + /// Send Catalog Template Message + /// + /// CatalogTemplateMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + public WhatsAppResponse SendCatalogMessageTemplate(CatalogTemplateMessageRequest catalogTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default) + { + if (cloudApiConfig is not null) + { + _whatsAppConfig = cloudApiConfig; + } + + var formattedWhatsAppEndpoint = WhatsAppBusinessRequestEndpoint.SendMessage.Replace("{{Phone-Number-ID}}", _whatsAppConfig.WhatsAppBusinessPhoneNumberId); + return WhatsAppBusinessPostAsync(catalogTemplateMessageRequest, formattedWhatsAppEndpoint, cancellationToken).GetAwaiter().GetResult(); + } + + /// + /// Send Catalog Message + /// + /// CatalogMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + public async Task SendCatalogMessageAsync(CatalogMessageRequest catalogMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default) + { + if (cloudApiConfig is not null) + { + _whatsAppConfig = cloudApiConfig; + } + + var formattedWhatsAppEndpoint = WhatsAppBusinessRequestEndpoint.SendMessage.Replace("{{Phone-Number-ID}}", _whatsAppConfig.WhatsAppBusinessPhoneNumberId); + return await WhatsAppBusinessPostAsync(catalogMessageRequest, formattedWhatsAppEndpoint, cancellationToken); + } + + /// + /// Send Catalog Message + /// + /// CatalogMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + public WhatsAppResponse SendCatalogMessage(CatalogMessageRequest catalogMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default) + { + if (cloudApiConfig is not null) + { + _whatsAppConfig = cloudApiConfig; + } + + var formattedWhatsAppEndpoint = WhatsAppBusinessRequestEndpoint.SendMessage.Replace("{{Phone-Number-ID}}", _whatsAppConfig.WhatsAppBusinessPhoneNumberId); + return WhatsAppBusinessPostAsync(catalogMessageRequest, formattedWhatsAppEndpoint, cancellationToken).GetAwaiter().GetResult(); + } + + /// + /// Send Carousel Template Message + /// + /// CarouselTemplateMessageRequest object + /// Custom WHatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + public async Task SendCarouselMessageTemplateAsync(CarouselTemplateMessageRequest carouselTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default) + { + if (cloudApiConfig is not null) + { + _whatsAppConfig = cloudApiConfig; + } + + var formattedWhatsAppEndpoint = WhatsAppBusinessRequestEndpoint.SendMessage.Replace("{{Phone-Number-ID}}", _whatsAppConfig.WhatsAppBusinessPhoneNumberId); + return await WhatsAppBusinessPostAsync(carouselTemplateMessageRequest, formattedWhatsAppEndpoint, cancellationToken); + } + + /// + /// Send Carousel Template Message + /// + /// CarouselTemplateMessageRequest object + /// Custom WHatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + public WhatsAppResponse SendCarouselMessageTemplate(CarouselTemplateMessageRequest carouselTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default) + { + if (cloudApiConfig is not null) + { + _whatsAppConfig = cloudApiConfig; + } + + var formattedWhatsAppEndpoint = WhatsAppBusinessRequestEndpoint.SendMessage.Replace("{{Phone-Number-ID}}", _whatsAppConfig.WhatsAppBusinessPhoneNumberId); + return WhatsAppBusinessPostAsync(carouselTemplateMessageRequest, formattedWhatsAppEndpoint, cancellationToken).GetAwaiter().GetResult(); + } + + /// + /// Send Coupon Code Template Message + /// + /// CouponCodeTemplateMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + public async Task SendCouponCodeMessageTemplateAsync(CouponCodeTemplateMessageRequest couponCodeTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default) + { + if (cloudApiConfig is not null) + { + _whatsAppConfig = cloudApiConfig; + } + + var formattedWhatsAppEndpoint = WhatsAppBusinessRequestEndpoint.SendMessage.Replace("{{Phone-Number-ID}}", _whatsAppConfig.WhatsAppBusinessPhoneNumberId); + return await WhatsAppBusinessPostAsync(couponCodeTemplateMessageRequest, formattedWhatsAppEndpoint, cancellationToken); + } + + /// + /// Send Coupon Code Template Message + /// + /// CouponCodeTemplateMessageRequest object + /// Custom WhatsAppBusinessCloudApiConfig + /// Cancellation token + /// WhatsAppResponse + public WhatsAppResponse SendCouponCodeMessageTemplate(CouponCodeTemplateMessageRequest couponCodeTemplateMessageRequest, WhatsAppBusinessCloudApiConfig? cloudApiConfig = null, CancellationToken cancellationToken = default) + { + if (cloudApiConfig is not null) + { + _whatsAppConfig = cloudApiConfig; + } + + var formattedWhatsAppEndpoint = WhatsAppBusinessRequestEndpoint.SendMessage.Replace("{{Phone-Number-ID}}", _whatsAppConfig.WhatsAppBusinessPhoneNumberId); + return WhatsAppBusinessPostAsync(couponCodeTemplateMessageRequest, formattedWhatsAppEndpoint, cancellationToken).GetAwaiter().GetResult(); + } + /// /// You can use this endpoint to change two-step verification code associated with your account. After you change the verification code, future requests like changing the name, must use the new code. /// You set up two-factor verification and register a phone number in the same API call.