PHPackages                             getheybot/heybot-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. [API Development](/categories/api)
4. /
5. getheybot/heybot-php

ActiveLibrary[API Development](/categories/api)

getheybot/heybot-php
====================

Official PHP client for the Heybot WhatsApp API

1.0.0(1mo ago)00MITPHPPHP ^8.4

Since Apr 28Pushed 1mo agoCompare

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

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

WhatsApp Client for PHP
=======================

[](#whatsapp-client-for-php)

Official PHP client for the [Heybot WhatsApp API](https://heybot.cloud).

Requirements
------------

[](#requirements)

- PHP 8.4+
- Composer

Installation
------------

[](#installation)

```
composer require getheybot/heybot-php
```

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

[](#quick-start)

```
use Heybot\Client;

$heybot = new Client('your-api-key');
```

---

Sending Messages
----------------

[](#sending-messages)

### Text

[](#text)

```
$heybot->message->send([
    'to'   => '+521234567890',
    'type' => 'text',
    'text' => ['body' => 'Hello from Heybot!'],
]);
```

### Image

[](#image)

```
$heybot->message->send([
    'to'    => '+521234567890',
    'type'  => 'image',
    'image' => [
        'url'     => 'https://example.com/photo.jpg',
        'caption' => 'Check this out!',
    ],
]);
```

### Document

[](#document)

```
$heybot->message->send([
    'to'       => '+521234567890',
    'type'     => 'document',
    'document' => [
        'url'      => 'https://example.com/file.pdf',
        'filename' => 'invoice.pdf',
        'caption'  => 'Your invoice',
    ],
]);
```

### Template

[](#template)

```
$heybot->message->send([
    'to'       => '+521234567890',
    'type'     => 'template',
    'template' => [
        'name'     => 'hello_world',
        'language' => ['code' => 'en_US'],
    ],
]);
```

---

Webhooks
--------

[](#webhooks)

Use `WebhookParser` to parse incoming webhook payloads into typed event objects.

```
use Heybot\Webhook\WebhookParser;

// From a raw JSON string (e.g. request body)
$event = WebhookParser::fromJson($request->getContent());

// Or from an already-decoded array
$event = WebhookParser::parse($payload);
```

### Handling events

[](#handling-events)

```
use Heybot\Webhook\Events\TextEvent;
use Heybot\Webhook\Events\ImageEvent;
use Heybot\Webhook\Events\AudioEvent;
use Heybot\Webhook\Events\VideoEvent;
use Heybot\Webhook\Events\DocumentEvent;
use Heybot\Webhook\Events\StickerEvent;
use Heybot\Webhook\Events\ButtonEvent;
use Heybot\Webhook\Events\InteractiveEvent;
use Heybot\Webhook\Events\LocationEvent;
use Heybot\Webhook\Events\ReactionEvent;
use Heybot\Webhook\Events\ContactEvent;

match (true) {
    $event instanceof TextEvent        => handleText($event->body),
    $event instanceof ImageEvent       => handleImage($event->url, $event->caption),
    $event instanceof AudioEvent       => handleAudio($event->url, $event->voice),
    $event instanceof VideoEvent       => handleVideo($event->url),
    $event instanceof DocumentEvent    => handleDoc($event->filename, $event->url),
    $event instanceof StickerEvent     => handleSticker($event->url, $event->animated),
    $event instanceof ButtonEvent      => handleButton($event->payload),
    $event instanceof InteractiveEvent => handleInteractive($event),
    $event instanceof LocationEvent    => handleLocation($event->latitude, $event->longitude),
    $event instanceof ReactionEvent    => handleReaction($event->emoji, $event->messageId),
    $event instanceof ContactEvent     => handleContacts($event->contacts),
    default                            => null,
};
```

All events share these base properties:

PropertyTypeDescription`$event->id``string`Unique message ID`$event->timestamp``int`Unix timestamp`$event->channel``string`e.g. `"whatsapp"``$event->type``string`Message type`$event->from->phoneNumber``string`Sender's phone number`$event->from->displayName``string`Sender's display name`$event->to->phoneNumber``string`Recipient phone number`$event->to->phoneNumberId``string`Recipient phone number ID### Event types

[](#event-types)

#### TextEvent

[](#textevent)

```
$event->body; // string — message text
```

#### AudioEvent

[](#audioevent)

```
$event->url;      // string
$event->mimeType; // string
$event->sha256;   // string
$event->voice;    // bool — true if voice note
```

#### ImageEvent / VideoEvent

[](#imageevent--videoevent)

```
$event->url;      // string
$event->mimeType; // string
$event->sha256;   // string
$event->caption;  // ?string  (image only)
$event->context?->forwarded;           // ?bool
$event->context?->frequentlyForwarded; // ?bool
```

#### DocumentEvent

[](#documentevent)

```
$event->url;      // string
$event->filename; // string
$event->mimeType; // string
$event->sha256;   // string
$event->caption;  // ?string
```

#### StickerEvent

[](#stickerevent)

```
$event->url;      // string
$event->mimeType; // string
$event->sha256;   // string
$event->animated; // bool
```

#### ButtonEvent

[](#buttonevent)

```
$event->payload; // string — button ID / payload
$event->text;    // string — button label
```

#### InteractiveEvent

[](#interactiveevent)

```
$event->interactiveType;  // 'list_reply' | 'button_reply'
$event->replyId;          // string
$event->replyTitle;       // string
$event->replyDescription; // ?string (list_reply only)

$event->isListReply();   // bool
$event->isButtonReply(); // bool
```

#### LocationEvent

[](#locationevent)

```
$event->latitude;  // float
$event->longitude; // float
$event->address;   // string
$event->name;      // ?string
$event->url;       // ?string
```

#### ReactionEvent

[](#reactionevent)

```
$event->messageId; // string — ID of the message reacted to
$event->emoji;     // string — empty string means reaction was removed

$event->isRemoval(); // bool
```

#### ContactEvent

[](#contactevent)

```
foreach ($event->contacts as $contact) {
    $contact->name->formattedName; // string
    $contact->name->firstName;     // ?string
    $contact->name->lastName;      // ?string

    $contact->phones[0]->phone; // string
    $contact->phones[0]->waId;  // ?string
    $contact->phones[0]->type;  // ?string (e.g. 'MOBILE')

    $contact->emails[0]->email; // string
    $contact->emails[0]->type;  // ?string

    $contact->addresses[0]->street;      // ?string
    $contact->addresses[0]->city;        // ?string
    $contact->addresses[0]->state;       // ?string
    $contact->addresses[0]->zip;         // ?string
    $contact->addresses[0]->country;     // ?string
    $contact->addresses[0]->countryCode; // ?string

    $contact->org?->company;    // ?string
    $contact->org?->department; // ?string
    $contact->org?->title;      // ?string

    $contact->urls[0]->url;  // string
    $contact->urls[0]->type; // ?string

    $contact->birthday; // ?string (e.g. '1990-01-15')
}
```

---

Error Handling
--------------

[](#error-handling)

```
use Heybot\Exceptions\AuthenticationException;
use Heybot\Exceptions\RateLimitException;
use Heybot\Exceptions\InvalidRequestException;
use Heybot\Exceptions\ApiException;

try {
    $heybot->message->send([...]);
} catch (AuthenticationException $e) {
    // 401 — invalid API key
} catch (RateLimitException $e) {
    // 429 — too many requests
} catch (InvalidRequestException $e) {
    // 4xx — bad request
    echo $e->getErrorCode(); // API error code if provided
} catch (ApiException $e) {
    // 5xx or network error
}
```

---

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance91

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1441444?v=4)[J. Daniel Salcedo Sambrano](/maintainers/dsalcedo)[@dsalcedo](https://github.com/dsalcedo)

---

Top Contributors

[![batnieluyo](https://avatars.githubusercontent.com/u/78667266?v=4)](https://github.com/batnieluyo "batnieluyo (1 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/getheybot-heybot-php/health.svg)

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

###  Alternatives

[temporal/sdk

Temporal SDK

4082.7M22](/packages/temporal-sdk)[storyblok/php-management-api-client

Storyblok PHP Client for Management API

1229.6k2](/packages/storyblok-php-management-api-client)

PHPackages © 2026

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