---
title: "Other languages"
description: "Call the Wazapin HTTP API directly from Python, Go, PHP, or any language with fetch/cURL."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.wzpn.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Other languages

For TypeScript, use the official [`@wazapin/sdk`](/sdk/typescript) — typed builders, retries, and webhook helpers included.

For every other runtime, call the REST API with your API key (`X-Api-Key`). Same endpoints, same payloads.

## cURL

```bash
curl -X POST "https://api.wazapin.com/v1/messages" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
"channel_id": "wzp_ch_123",
"to": "6281234567890",
"type": "text",
"content": { "body": "Hello from Wazapin" }
  }'
```

## Python

```python
import os
import requests

response = requests.post(
"https://api.wazapin.com/v1/messages",
headers={
    "X-Api-Key": os.environ["WAZAPIN_API_KEY"],
    "Content-Type": "application/json",
},
json={
    "channel_id": "wzp_ch_123",
    "to": "6281234567890",
    "type": "text",
    "content": {"body": "Hello from Wazapin"},
},
timeout=20,
)

response.raise_for_status()
print(response.json())
```

## Go

```go
package main

import (
	"bytes"
	"encoding/json"
	"net/http"
	"os"
)

func main() {
	payload := map[string]any{
		"channel_id": "wzp_ch_123",
		"to":         "6281234567890",
		"type":       "text",
		"content":    map[string]any{"body": "Hello from Wazapin"},
	}

	body, _ := json.Marshal(payload)
	req, _ := http.NewRequest(http.MethodPost, "https://api.wazapin.com/v1/messages", bytes.NewReader(body))
	req.Header.Set("X-Api-Key", os.Getenv("WAZAPIN_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
}
```

## PHP

```php
<?php

$payload = '{
  "channel_id": "wzp_ch_123",
  "to": "6281234567890",
  "type": "text",
  "content": {"body": "Hello from Wazapin"}
}';

$ch = curl_init("https://api.wazapin.com/v1/messages");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"X-Api-Key: " . getenv("WAZAPIN_API_KEY"),
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo $httpCode . "\n" . $response . "\n";
```

## Java

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class SendMessage {
public static void main(String[] args) throws Exception {
    String body = """
            {"channel_id":"wzp_ch_123","to":"6281234567890","type":"text","content":{"body":"Hello from Wazapin"}}
            """;

    HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.wazapin.com/v1/messages"))
            .header("X-Api-Key", System.getenv("WAZAPIN_API_KEY"))
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(body))
            .build();

    HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());

    System.out.println(response.statusCode());
    System.out.println(response.body());
}
}
```

## Ruby

```ruby
require "net/http"
require "uri"

uri = URI("https://api.wazapin.com/v1/messages")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["X-Api-Key"] = ENV["WAZAPIN_API_KEY"]
request.body = '{"channel_id":"wzp_ch_123","to":"6281234567890","type":"text","content":{"body":"Hello from Wazapin"}}'

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.code
puts response.body
```

## C#

```csharp
using System.Net.Http;
using System.Text;

var body = "{\"channel_id\":\"wzp_ch_123\",\"to\":\"6281234567890\",\"type\":\"text\",\"content\":{\"body\":\"Hello from Wazapin\"}}";

using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-Api-Key", Environment.GetEnvironmentVariable("WAZAPIN_API_KEY"));

var response = await client.PostAsync(
"https://api.wazapin.com/v1/messages",
new StringContent(body, Encoding.UTF8, "application/json"));

Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

## Links

- [TypeScript SDK](/sdk/typescript)
- [Authentication](/api/authentication)
- [Quickstart](/getting-started/quickstart)
- [Webhooks](/api/webhooks)

Source: https://docs.wzpn.net/api/sdks/index.mdx
