To make integration with our WhatsApp API service easier, we provide official SDKs for popular programming languages and frameworks. This page lists available SDKs and community-maintained libraries.
Our official SDKs provide a convenient way to interact with the WhatsApp API service from your preferred programming language.
npm install whatsapp-api-client
const WhatsAppClient = require('whatsapp-api-client');
const client = new WhatsAppClient({
apiKey: 'YOUR_API_KEY'
});
async function sendMessage() {
try {
const result = await client.messages.sendText({
sessionId: 'session_123abc',
to: '14155552671',
text: 'Hello from the WhatsApp API!'
});
} catch (error) {
}
}
pip install whatsapp-api-python
from whatsapp_api import WhatsAppClient
client = WhatsAppClient(api_key='YOUR_API_KEY')
def send_message():
try:
result = client.messages.send_text(
session_id='session_123abc',
to='14155552671',
text='Hello from the WhatsApp API!'
)
print(f"Message sent: {result['data']['messageId']}")
except Exception as e:
print(f"Failed to send message: {e}")
composer require messaging/whatsapp-api-php
<?php
require_once 'vendor/autoload.php';
use Messaging\WhatsAppApi\Client;
$client = new Client('YOUR_API_KEY');
try {
$result = $client->messages->sendText([
'sessionId' => 'session_123abc',
'to' => '14155552671',
'text' => 'Hello from the WhatsApp API!'
]);
echo "Message sent: " . $result['data']['messageId'];
} catch (Exception $e) {
echo "Failed to send message: " . $e->getMessage();
}
?>
Maven:
<dependency>
<groupId>com.messaging</groupId>
<artifactId>whatsapp-api-java</artifactId>
<version>1.0.0</version>
</dependency>
Gradle:
implementation 'com.messaging:whatsapp-api-java:1.0.0'
import com.messaging.whatsapp.WhatsAppClient;
import com.messaging.whatsapp.models.TextMessage;
import com.messaging.whatsapp.responses.MessageResponse;
public class WhatsAppExample {
public static void main(String[] args) {
WhatsAppClient client = new WhatsAppClient("YOUR_API_KEY");
try {
TextMessage message = new TextMessage()
.sessionId("session_123abc")
.to("14155552671")
.text("Hello from the WhatsApp API!");
MessageResponse response = client.messages().sendText(message);
System.out.println("Message sent: " + response.getData().getMessageId());
} catch (Exception e) {
System.err.println("Failed to send message: " + e.getMessage());
}
}
}
These libraries are maintained by the community and provide additional functionality or integration with specific frameworks.
| Library | Language/Framework | Description | Links |
|---|---|---|---|
| whatsapp-api-react | React | React components and hooks for WhatsApp API integration | GitHub | NPM |
| whatsapp-api-laravel | Laravel | Laravel package for WhatsApp API integration | GitHub | Packagist |
| whatsapp-api-django | Django | Django app for WhatsApp API integration | GitHub | PyPI |
| whatsapp-api-go | Go | Go client for WhatsApp API | GitHub |
| whatsapp-api-ruby | Ruby | Ruby gem for WhatsApp API integration | GitHub | RubyGems |
Our official SDKs provide the following features:
We welcome contributions to our SDKs and libraries! If you'd like to contribute, please follow these steps:
For more detailed information, please see the CONTRIBUTING.md file in each repository.
If you encounter any issues with our SDKs or have questions about integration, you can get help through the following channels: