WABA360Dialog.NET
1.0.0-beta.6
See the version list below for details.
dotnet add package WABA360Dialog.NET --version 1.0.0-beta.6
NuGet\Install-Package WABA360Dialog.NET -Version 1.0.0-beta.6
<PackageReference Include="WABA360Dialog.NET" Version="1.0.0-beta.6" />
paket add WABA360Dialog.NET --version 1.0.0-beta.6
#r "nuget: WABA360Dialog.NET, 1.0.0-beta.6"
// Install WABA360Dialog.NET as a Cake Addin #addin nuget:?package=WABA360Dialog.NET&version=1.0.0-beta.6&prerelease // Install WABA360Dialog.NET as a Cake Tool #tool nuget:?package=WABA360Dialog.NET&version=1.0.0-beta.6&prerelease
WABA360Dialog.NET
C# .NET API Wrapper Classes for 360Dialog WhatsApp Business APIs and Partner APIs
- 360Dialog WhatsApp Business API Client
- 360Dialog WhatsApp Business API Sandbox Client
- 360Dialog Partner API
- Webhook Models
Getting Started
To get started, you must own an API Key managed by 360Dialog.
- WABA360DialogApiClient.cs / WABA360DialogApiSandboxClient.cs (WhatsApp API Business API)
var client = new WABA360DialogApiClient("your-api-key");
var createMessageResposne = await client.SendMessageAsync(MessageObjectFactory.CreateTextMessage("whatsapp-id", "Hello World!"));
- WABA360DialogPartnerClient.cs (360Dialog Partner API)
var partnerClient = new WABA360DialogPartnerClient("partner-id","access-token"));
// or
var partnerClient = new WABA360DialogPartnerClient(new PartnerInfo("partner-id", "username", "password")); // For auto login
var clientBalanceResponse = await partnerClient.GetClientBalanceAsync("client-id", 1, 2022);
Available Functions
All existing API provided by 360 Dialog are wrapped as functions for corresponding client
- WABA360DialogApiClient.cs / WABA360DialogApiSandboxClient.cs (WhatsApp API Business API)
Task<GetWebhookUrlResponse> GetWebhookUrlAsync();
Task<SetWebhookUrlResponse> SetWebhookUrlAsync(string url, Dictionary<string, string> headers);
Task<CheckContactsResponse> CheckContactsAsync(IEnumerable<string> contacts, Blocking blocking = Blocking.no_wait, bool forceCheck = false);
Task<SendMessageResponse> SendMessageAsync(MessageObject message);
Task<SendMessageResponse> SendMessageAsync(object message);
Task<GetMediaResponse> GetMediaAsync(string mediaId);
Task<UploadMediaResponse> UploadMediaAsync(byte[] fileBytes, string contentType);
Task<GetTemplateResponse> GetTemplateAsync(int limit = 1000, int offset = 0, string sort = null, CancellationToken cancellationToken = default);
Task<CreateTemplateResponse> CreateTemplateAsync(CreateTemplateObject template, CancellationToken cancellationToken = default);
Task<DeleteTemplateResponse> DeleteTemplateAsync(string templateName, CancellationToken cancellationToken = default);
Task<UpdateBusinessProfileResponse> UpdateBusinessProfileAsync(IEnumerable<string> vertical, IEnumerable<string> websites, string email, string description, string address);
Task<UpdateProfileInfoAboutTextResponse> UpdateProfileInfoAboutTextAsync(string aboutText);
Task<UpdateProfileInfoPhotoResponse> UpdateProfileInfoPhotoAsync(byte[] fileBytes, string contentType);
- WABA360DialogPartnerClient.cs (360Dialog Partner API)
Task<CreatePartnerWhatsAppBusinessApiTemplateResponse> CreatePartnerWhatsAppBusinessApiTemplateAsync(string whatsAppBusinessApiAccountId, string name, TemplateCategory category, WhatsAppLanguage language, TemplateComponentObject components, CancellationToken cancellationToken = default);
Task<GetClientBalanceResponse> GetClientBalanceAsync(string clientId, int fromMonth, int fromYear, CancellationToken cancellationToken = default);
Task<GetPartnerChannelsResponse> GetPartnerChannelsAsync(int limit = 20, int offset = 0, string sort = null, GetPartnerChannelsFilter filters = null, CancellationToken cancellationToken = default);
Task<GetPartnerClientsResponse> GetPartnerClientsAsync(int limit = 20, int offset = 0, string sort = null, GetPartnerClientsFilter filters = null, CancellationToken cancellationToken = default);
Task<GetPartnerWebhookUrlResponse> GetPartnerWebhookUrlAsync(CancellationToken cancellationToken = default);
Task<GetPartnerWhatsAppBusinessApiTemplatesResponse> GetPartnerWhatsAppBusinessApiTemplatesAsync(string whatsAppBusinessApiAccountId, int limit = 1000, int offset = 0, string sort = null, GetPartnerWhatsAppBusinessApiTemplatesFilter filters = null, CancellationToken cancellationToken = default);
Task<RemovePartnerWhatsAppBusinessApiTemplatesResponse> RemovePartnerWhatsAppBusinessApiTemplatesAsync(string whatsAppBusinessApiAccountId, string templateId, CancellationToken cancellationToken = default);
Task<SetCancellationRequestOnChannelResponse> SetCancellationRequestOnChannelAsync(string clientId, string channelId, bool enabled, CancellationToken cancellationToken = default);
Task<SetPartnerWebhookUrlResponse> SetPartnerWebhookUrlAsync(string webhookUrl, CancellationToken cancellationToken = default);
Task<UpdateClientResponse> UpdateClientAsync(string clientId, string partnerPayload, CancellationToken cancellationToken = default);
Task<TokenResponse> RequestOAuthTokenAsync(string username, string password, CancellationToken cancellationToken = default);
Helpers
- MessageObjectFactory.cs for creating common MessageObject in WABA360DialogApiClient.SendMessage()
MessageObjectFactory.CreateTextMessage(string whatsAppId, string textMessage, bool previewUrl = false);
MessageObjectFactory.CreateImageMessageByMediaId(string whatsAppId, string mediaId, string caption);
MessageObjectFactory.CreateImageMessageByLink(string whatsAppId, string imageLink, string caption, ProviderObject provider = null);
MessageObjectFactory.CreateVideoMessageByMediaId(string whatsAppId, string mediaId, string caption);
MessageObjectFactory.CreateVideoMessageByLink(string whatsAppId, string imageLink, string caption, ProviderObject provider = null);
MessageObjectFactory.CreateDocumentMessageByMediaId(string whatsAppId, string fileName, string mediaId, string caption);
MessageObjectFactory.CreateDocumentMessageByLink(string whatsAppId, string fileName, string documentLink, string caption, ProviderObject provider = null);
MessageObjectFactory.CreateAudioMessageByMediaId(string whatsAppId, string mediaId);
MessageObjectFactory.CreateAudioMessageByLink(string whatsAppId, string audioLink, ProviderObject provider = null);
MessageObjectFactory.CreateStickerMessageByMediaId(string whatsAppId, string mediaId);
MessageObjectFactory.CreateStickerMessageByLink(string whatsAppId, string stickerLink, ProviderObject provider = null);
MessageObjectFactory.CreateTemplateMessage(string whatsAppId, string templateNamespace, string templateName, WhatsAppLanguage language, List<ComponentObject> components);
MessageObjectFactory.CreateInteractiveMessage(string whatsappId, InteractiveObject interactiveObject);
Enums
The Enums definition, value, converters are located at these folders:
ApiClient\Payloads\Converters\...
ApiClient\Payloads\Enums\...
PartnerClient\Payloads\Converters\...
PartnerClient\Payloads\Enums\...
Common\Converters\...
Common\Enums\...
- To Get the string value of the enums, use
.GetString()
However, once Facebook updated the enums string value may cause issues during JSON deserialize.
Webhook Models
Webhook Models classes (Recommend using Newtonsoft.Json >= 13.01 for JSON deserialization):
- WhatsApp API Business API
ApiClient\Payloads\Models\WABA360DialogWebhookPayload.cs
- 360Dialog Partner API
PartnerClient\Payloads\Models\WABA360DialogPartnerWebhookPayload.cs
Exceptions
Exceptions will throw when Response HTTP Status Code or Response is not success.
- WhatsApp API Business API
ApiClientException // Throw when Response HTTP status code is not success, use ex.ToString() / ex.Error to access detail
- 360Dialog Partner API
PartnerClientException // Throw when HTTP Response Status Code is not success, use ex.ToString() / ex.Message to access detail
PartnerClientAuthenticationException // Throw when HTTP Response Status Code is 401 like access token invalid or no credentials set.
Extendability
Feel free to extend or improve the capability of the current version of the client that cannot satisfy all your needs.
Please visit these Folder for more details:
ApiClient\Interfaces // Abstract WhatsApp Business API Client class
ApiClient\Payloads\Base // Abstract WhatsApp Business API Request & Response class
ApiClient\Payloads\ // Concrete WhatsApp Business API Request & Response class
PartnerClient\Interfaces // Abstract Partner API Client class
PartnerClient\Payloads\Base // Abstract Partner API Request & Response class
PartnerClient\Payloads\ // Concrete Partner API Request & Response class
Official Documents
- Introduction: https://docs.360dialog.com/
- WhatsApp Business API Documents: https://docs.360dialog.com/whatsapp-api/whatsapp-api
- Sandbox Documents: https://docs.360dialog.com/whatsapp-api/whatsapp-api/sandbox
- Facebook API: https://developers.facebook.com/docs/whatsapp/api/messages
- Partner API Documents: https://api.360dialog.com/
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.0.4 | 12,253 | 11/1/2023 | |
1.0.3 | 812 | 10/3/2023 | |
1.0.2 | 7,700 | 7/10/2023 | |
1.0.1 | 330 | 6/13/2023 | |
1.0.0 | 1,509 | 1/3/2023 | |
1.0.0-beta.23 | 388 | 9/5/2022 | |
1.0.0-beta.22 | 146 | 8/11/2022 | |
1.0.0-beta.21 | 109 | 8/11/2022 | |
1.0.0-beta.20 | 7,995 | 5/4/2022 | |
1.0.0-beta.19 | 440 | 3/18/2022 | |
1.0.0-beta.18 | 133 | 3/14/2022 | |
1.0.0-beta.17 | 116 | 3/10/2022 | |
1.0.0-beta.16 | 113 | 3/4/2022 | |
1.0.0-beta.15 | 114 | 3/1/2022 | |
1.0.0-beta.14 | 111 | 2/18/2022 | |
1.0.0-beta.13 | 109 | 2/17/2022 | |
1.0.0-beta.12 | 109 | 2/11/2022 | |
1.0.0-beta.11 | 159 | 2/5/2022 | |
1.0.0-beta.10 | 153 | 2/4/2022 | |
1.0.0-beta.9 | 162 | 1/31/2022 | |
1.0.0-beta.8 | 154 | 1/28/2022 | |
1.0.0-beta.7 | 157 | 1/28/2022 | |
1.0.0-beta.6 | 149 | 1/28/2022 | |
1.0.0-beta.5 | 159 | 1/25/2022 | |
1.0.0-beta.4 | 162 | 1/24/2022 | |
1.0.0-beta.3 | 160 | 1/20/2022 |