Simple Whatsapp API Wrapper - ease of development
License
—
Deps
2
Install Size
—
Vulns
✓ 0
Published
Jul 23, 2025
$ dotnet add package Ark.WappHere's a comprehensive and developer-friendly README.md file for your C# WhatsApp Library named Ark.Wapp. This README is structured to help new developers quickly understand, use, and extend the library effectively.
# Ark.Wapp 📱
**A lightweight and extensible C# library to parse and manage WhatsApp Business API messages.**
## ✨ Features
- ✅ Simple parsing of WhatsApp Webhook messages
- ✅ Support for all message types: text, image, audio, video, document, location, sticker, interactive, buttons
- ✅ Extract response and status details easily
- ✅ Utility methods for token and URL configuration
- ✅ Template message generator for outbound communication
---
## 🚀 Getting Started
### 1. Installation
nuget install:
[](https://www.nuget.org/packages/Ark.Wapp)
NuGet\Install-Package Ark.Wapp
```bash
dotnet add package Newtonsoft.Json
```
---
## 📦 Namespaces
```csharp
using Ark.Wapp;
```
---
## 🛠️ Core Components
### `ArkWappManager.ExtractResponse(string msg)`
Parses incoming webhook payload and extracts the **contact ID**, **message ID**, **status**, and **error details**.
```csharp
var response = ArkWappManager.ExtractResponse(jsonString);
Console.WriteLine(response.mob_id); // WhatsApp ID
Console.WriteLine(response.status); // Status or Error Type
```
---
### `ArkWappManager.ExtractContent(string msg)`
Asynchronously parses the payload and extracts **sender ID**, **receiver ID**, **message type**, **timestamp**, **profile name**, and the actual message content.
```csharp
WMessage content = await ArkWappManager.ExtractContent(jsonString);
Console.WriteLine(content.msg_type); // text, image, audio, etc.
Console.WriteLine(content.msg_info?.body ?? content.msg_info?.caption);
```
Supports:
* `text`
* `image`, `video`, `audio`, `document`
* `location`
* `interactive`, `button`, `sticker`
* `failed` with error extraction
---
### `WImp` Static Helpers
#### ✅ WhatsApp Token and URL
```csharp
string token = WABA_TOKEN;
string endpoint = WImp.wapp_url;
```
#### 📍 Reverse Geocode URLs
```csharp
string googleUrl = WImp.google_map_geocode_reverse_url("10.123", "78.456");
string geonamesUrl = WImp.geonames_geocode_reverse_url("10.123", "78.456");
```
#### 📤 Template Message Generator
```csharp
var message = WImp.wapp_template_message(new WTempateParam {
mob_id = "919XXXXXXXXX",
template_id = "sample_template",
lang = "en_US",
body_params = new List<object> {
new { type = "text", text = "John" }
}
});
```
Returns the ready-to-send WhatsApp message payload.
---
## 📘 Models
* `WResponse`: Contains `mob_id`, `wam_id`, `status`, `http_response_code`, `details`, and `wa_timestamp`
* `WMessage`: Core message structure
* `WMsgInfo`: Carries metadata like caption, file IDs, mime\_type, etc.
* `WError`: WhatsApp delivery failure info
* `WPriceInfo`: Billing details if available
* `WTempateParam`: Template payload definition
---
## 🧪 Sample Usage
```csharp
string webhookJson = File.ReadAllText("webhook_payload.json");
var content = await ArkWappManager.ExtractContent(webhookJson);
if (content.msg_type == "text")
{
Console.WriteLine("Text message: " + content.msg_info.body);
}
```
---
## 📂 Configuration
Ensure the following keys are available in your config system (`ArkConfig.ReadValue` looks these up):
* `wapp_perm_token`
* `google_map_api_key`
* `google_map_api_url`
* `geonames_geocode_url`
* `wapp_waba_mobile_no`
* `wapp_url`
---
## ⚙️ Requirements
* .NET Standard 2.0+ / .NET Core / .NET 5+
* Newtonsoft.Json
---
## 📄 License
MIT License. See `LICENSE` file.
---
## 🤝 Contribution
Pull requests and suggestions are welcome! If you find any issues, feel free to raise them.
---
## 🙏 Acknowledgments
* WhatsApp Business API documentation
* Newtonsoft.Json for JSON parsing
* Developers using Ark for conversational automation!
```
---
Would you like me to generate this as a downloadable `.md` file or tailor it to a specific platform (e.g., NuGet, GitHub)?
```