using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
var url = "https://darajapay.com/api/v1/whatsapp/bulk-send";
var data = new
{
message_type = "text",
session = "YOUR_SESSION_ID",
message = "Hello, this is a bulk message",
recipients = new[] { "254712345678", "254723456789", "254734567890" }
};
client.DefaultRequestHeaders.Add("Authorization", "Basic YOUR_API_KEY");
var json = JsonSerializer.Serialize(data);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
Go
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://darajapay.com/api/v1/whatsapp/bulk-send"
data := map[string]interface{}{
"message_type": "text",
"session": "YOUR_SESSION_ID",
"message": "Hello, this is a bulk message",
"recipients": []string{"254712345678", "254723456789", "254734567890"},
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Basic YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}