PHPackages                             willenrocha/zapapi-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. willenrocha/zapapi-php

ActiveLibrary

willenrocha/zapapi-php
======================

SDK oficial PHP para a API ZapApi — WhatsApp para desenvolvedores

00PHP

Since Apr 6Pushed 1mo agoCompare

[ Source](https://github.com/willenrocha/zapapi-php)[ Packagist](https://packagist.org/packages/willenrocha/zapapi-php)[ RSS](/packages/willenrocha-zapapi-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ZapApi PHP SDK
==============

[](#zapapi-php-sdk)

[![Latest Version](https://camo.githubusercontent.com/229e49d369a40f781507442d595083fecad671f0ff53b3bbb3ddd2857a40523a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77696c6c656e726f6368612f7a61706170692d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/willenrocha/zapapi-php)[![PHP Version](https://camo.githubusercontent.com/01a488e85b7713a305b886c2e311a0b58d956bd882ba219ef8abd532e5c84334/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f77696c6c656e726f6368612f7a61706170692d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/willenrocha/zapapi-php)[![License](https://camo.githubusercontent.com/880770b80e86480213ef918d4918e5185359a7be743f5ec9d3db737e366762ad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77696c6c656e726f6368612f7a61706170692d7068702e7376673f7374796c653d666c61742d737175617265)](LICENSE)

SDK oficial PHP para a [ZapApi](https://zapapi.net) — WhatsApp API para desenvolvedores.

Requisitos
----------

[](#requisitos)

- PHP 8.1+
- Extensao JSON
- Conta na [ZapApi](https://zapapi.net) com API key

Instalacao
----------

[](#instalacao)

```
composer require willenrocha/zapapi-php
```

Quick Start
-----------

[](#quick-start)

```
use Inovix\ZapApi\Client;

$client = new Client('sua-api-key');

// Criar uma sessao
$session = $client->sessions->create('minha-sessao');

// Obter QR Code para conectar
$qr = $client->sessions->getQrCode($session['id']);

// Enviar mensagem de texto
$client->messages->sendText(
    sessionId: $session['id'],
    to: '5511999999999',
    text: 'Ola! Mensagem enviada via ZapApi.',
);
```

Configuracao
------------

[](#configuracao)

```
$client = new Client('sua-api-key', [
    'base_url' => 'https://api.zapapi.net',  // padrao
    'timeout'  => 30,                         // segundos
]);
```

Referencia da API
-----------------

[](#referencia-da-api)

### Sessoes

[](#sessoes)

```
// Criar sessao
$session = $client->sessions->create('nome-da-sessao');

// Listar sessoes
$sessions = $client->sessions->list();

// Obter sessao
$session = $client->sessions->get('session-id');

// QR Code
$qr = $client->sessions->getQrCode('session-id');

// Conectar / Desconectar
$client->sessions->connect('session-id');
$client->sessions->disconnect('session-id');

// Deletar sessao
$client->sessions->delete('session-id');

// Perfil da sessao
$profile = $client->sessions->getProfile('session-id');
$client->sessions->updateProfile('session-id', [
    'name' => 'Novo Nome',
    'status' => 'Usando ZapApi',
]);
```

### Mensagens

[](#mensagens)

```
// Texto
$client->messages->sendText('session-id', '5511999999999', 'Ola!');

// Midia (imagem, video, audio, documento)
$client->messages->sendMedia(
    sessionId: 'session-id',
    to: '5511999999999',
    mediaType: 'image',
    media: 'https://exemplo.com/foto.jpg',
    caption: 'Veja esta imagem!',
);

// Localizacao
$client->messages->sendLocation(
    sessionId: 'session-id',
    to: '5511999999999',
    latitude: -23.5505,
    longitude: -46.6333,
    name: 'Sao Paulo',
    address: 'Sao Paulo, SP, Brasil',
);

// Contato
$client->messages->sendContact('session-id', '5511999999999', [
    'fullName' => 'Maria Silva',
    'phoneNumber' => '5511888888888',
]);

// Enquete
$client->messages->sendPoll(
    sessionId: 'session-id',
    to: '5511999999999',
    name: 'Qual sua cor favorita?',
    options: ['Azul', 'Vermelho', 'Verde'],
);

// Reacao
$client->messages->sendReaction('session-id', '5511999999999', 'msg-id', "\u{1F44D}");

// Sticker
$client->messages->sendSticker('session-id', '5511999999999', 'https://exemplo.com/sticker.webp');

// Botoes e lista
$client->messages->sendButtons('session-id', [
    'to' => '5511999999999',
    'text' => 'Escolha uma opcao:',
    'buttons' => [
        ['id' => '1', 'text' => 'Opcao 1'],
        ['id' => '2', 'text' => 'Opcao 2'],
    ],
]);

$client->messages->sendList('session-id', [
    'to' => '5511999999999',
    'title' => 'Menu',
    'buttonText' => 'Ver opcoes',
    'sections' => [
        [
            'title' => 'Secao 1',
            'rows' => [
                ['id' => '1', 'title' => 'Item 1', 'description' => 'Descricao'],
            ],
        ],
    ],
]);

// Deletar mensagem
$client->messages->delete('session-id', '5511999999999', 'msg-id');

// Marcar como lida
$client->messages->markAsRead('session-id', '5511999999999', 'msg-id');

// Enviar digitando
$client->messages->sendTyping('session-id', '5511999999999', duration: 5);
```

### Grupos

[](#grupos)

```
// Criar grupo
$group = $client->groups->create('session-id', 'Nome do Grupo', [
    '5511999999999',
    '5511888888888',
]);

// Listar grupos
$groups = $client->groups->list('session-id');

// Obter grupo
$group = $client->groups->get('session-id', 'group-id');

// Atualizar grupo
$client->groups->update('session-id', 'group-id', [
    'subject' => 'Novo Nome',
    'description' => 'Nova descricao',
]);

// Gerenciar participantes
$client->groups->addParticipants('session-id', 'group-id', ['5511999999999']);
$client->groups->removeParticipants('session-id', 'group-id', ['5511999999999']);
$client->groups->promoteParticipants('session-id', 'group-id', ['5511999999999']);
$client->groups->demoteParticipants('session-id', 'group-id', ['5511999999999']);

// Link de convite
$link = $client->groups->inviteLink('session-id', 'group-id');

// Sair do grupo
$client->groups->leave('session-id', 'group-id');
```

### Contatos

[](#contatos)

```
// Verificar se numero tem WhatsApp
$result = $client->contacts->check('session-id', '5511999999999');

// Verificar em lote
$results = $client->contacts->checkBatch('session-id', [
    '5511999999999',
    '5511888888888',
]);

// Foto de perfil
$picture = $client->contacts->profilePicture('session-id', '5511999999999');
```

### Webhooks

[](#webhooks)

```
// Criar webhook
$webhook = $client->webhooks->create('https://meusite.com/webhook', [
    'message.received',
    'message.sent',
    'session.status',
]);

// Listar webhooks
$webhooks = $client->webhooks->list();

// Obter webhook
$webhook = $client->webhooks->get('webhook-id');

// Atualizar webhook
$client->webhooks->update('webhook-id', [
    'url' => 'https://meusite.com/novo-webhook',
    'events' => ['message.received'],
]);

// Deletar webhook
$client->webhooks->delete('webhook-id');

// Ver entregas
$deliveries = $client->webhooks->deliveries('webhook-id');

// Testar webhook
$client->webhooks->test('webhook-id');
```

### Conta

[](#conta)

```
// Obter dados da conta
$account = $client->account->get();

// Atualizar conta
$client->account->update(['name' => 'Minha Empresa']);

// Uso / consumo
$usage = $client->account->usage();

// API Keys
$keys = $client->account->apiKeys();
$newKey = $client->account->createApiKey('chave-producao');
$client->account->revokeApiKey('key-id');
```

Verificacao de Webhooks
-----------------------

[](#verificacao-de-webhooks)

Valide assinaturas de webhook para garantir a autenticidade das requisicoes:

```
use Inovix\ZapApi\Webhook;

$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_ZAPAPI_SIGNATURE'] ?? '';
$secret = 'seu-webhook-secret';

if (Webhook::verify($payload, $signature, $secret)) {
    $event = json_decode($payload, true);
    // Processar evento...
} else {
    http_response_code(401);
    exit('Assinatura invalida');
}
```

Tratamento de Erros
-------------------

[](#tratamento-de-erros)

```
use Inovix\ZapApi\Exceptions\AuthenticationException;
use Inovix\ZapApi\Exceptions\RateLimitException;
use Inovix\ZapApi\Exceptions\ValidationException;
use Inovix\ZapApi\Exceptions\ZapApiException;

try {
    $client->messages->sendText('session-id', '5511999999999', 'Ola!');
} catch (AuthenticationException $e) {
    // API key invalida ou expirada
    echo "Erro de autenticacao: " . $e->getMessage();
} catch (RateLimitException $e) {
    // Limite de requisicoes excedido
    echo "Tente novamente em: " . $e->getRetryAfter() . " segundos";
} catch (ValidationException $e) {
    // Dados invalidos
    echo "Erros de validacao: ";
    print_r($e->getErrors());
} catch (ZapApiException $e) {
    // Outro erro da API
    echo "Erro [{$e->getStatusCode()}]: " . $e->getMessage();
}
```

Licenca
-------

[](#licenca)

MIT -- veja [LICENSE](LICENSE) para detalhes.

Links
-----

[](#links)

- [Site](https://zapapi.net)
- [Documentacao da API](https://docs.zapapi.net)
- [Suporte](mailto:dev@zapapi.net)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance61

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d09af131ff5fa84e924694166542f791d0898d87a97cbd0e3ffbb4e5eca6577?d=identicon)[willenrocha](/maintainers/willenrocha)

---

Top Contributors

[![willenrocha](https://avatars.githubusercontent.com/u/59326032?v=4)](https://github.com/willenrocha "willenrocha (2 commits)")

### Embed Badge

![Health badge](/badges/willenrocha-zapapi-php/health.svg)

```
[![Health](https://phpackages.com/badges/willenrocha-zapapi-php/health.svg)](https://phpackages.com/packages/willenrocha-zapapi-php)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
