PHPackages                             nexus-smart-solutions/whatsapp-ai-agent - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nexus-smart-solutions/whatsapp-ai-agent

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nexus-smart-solutions/whatsapp-ai-agent
=======================================

Plug-and-play WhatsApp AI sales agent powered by OpenAI, built for Laravel.

v1.0.1(1mo ago)00MITPHPPHP ^8.2

Since Jun 10Pushed 1mo agoCompare

[ Source](https://github.com/Nexus-smart-solutions/nexus-whatsapp-ai-agent)[ Packagist](https://packagist.org/packages/nexus-smart-solutions/whatsapp-ai-agent)[ RSS](/packages/nexus-smart-solutions-whatsapp-ai-agent/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

nexus/whatsapp-ai-agent
=======================

[](#nexuswhatsapp-ai-agent)

Plug-and-play WhatsApp AI sales agent for Laravel, powered by OpenAI.
Install once, customise per client via a single config file.

---

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

[](#requirements)

- PHP 8.2+
- Laravel 11 or 12
- An OpenWA (WWebJS) session running and accessible via HTTP
- An OpenAI API key

---

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

[](#installation)

```
composer require nexus-smart-solutions/whatsapp-ai-agent
```

Laravel auto-discovers the service provider. No manual registration needed.

---

Setup (3 steps)
---------------

[](#setup-3-steps)

### 1. Publish the config

[](#1-publish-the-config)

```
php artisan vendor:publish --tag=whatsapp-ai-agent-config
```

This creates `config/whatsapp-ai-agent.php` in your project.
**This is the only file you edit per client.**

### 2. Add environment variables to `.env`

[](#2-add-environment-variables-to-env)

```
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini
OPENAI_TEMPERATURE=0.7

OPENWA_BASE_URL=http://localhost:3000
OPENWA_API_KEY=your-openwa-api-key
OPENWA_SESSION=your-session-uuid

# Optional overrides
AI_WEBHOOK_URI=webhook/whatsapp
AI_HISTORY_LIMIT=10
AI_HUMAN_ACTIVE_MINUTES=30
```

### 3. Run migrations

[](#3-run-migrations)

Migrations load automatically from the package.
Just run:

```
php artisan migrate
```

Or publish them first if you want to inspect or modify them:

```
php artisan vendor:publish --tag=whatsapp-ai-agent-migrations
php artisan migrate
```

---

Customising the AI per client
-----------------------------

[](#customising-the-ai-per-client)

Open `config/whatsapp-ai-agent.php` and edit the `system_prompt` key:

```
'system_prompt' => 'You are a sales agent for Acme Corp ...',
```

You can also load it from an external file to keep the config clean:

```
'system_prompt' => file_get_contents(base_path('prompts/agent.txt')),
```

---

Webhook URL
-----------

[](#webhook-url)

The package registers the route automatically:

```
POST /webhook/whatsapp

```

Point your OpenWA session webhook to:

```
https://your-client-domain.com/webhook/whatsapp

```

To change the URI, update `AI_WEBHOOK_URI` in `.env` or edit `config/whatsapp-ai-agent.php`.

To disable auto-routing (if you want to register the route manually):

```
WHATSAPP_AI_REGISTER_ROUTES=false
```

Then in your `routes/api.php`:

```
Route::post('/my-custom-path', [\Nexus\WhatsAppAiAgent\Http\Controllers\WhatsAppWebhookController::class, 'handle']);
```

---

Human Agent Takeover
--------------------

[](#human-agent-takeover)

The AI automatically goes silent when a human agent is active.
Update these columns on the `ai_conversations` table from your agent dashboard:

ColumnTypeEffect`human_active`booleanAI silent while `true``agent_assigned`booleanAI silent while `true``human_last_active_at`timestampAI silent for `AI_HUMAN_ACTIVE_MINUTES` after this time---

Using the services directly
---------------------------

[](#using-the-services-directly)

All three services are bound in the container and can be injected:

```
use Nexus\WhatsAppAiAgent\Services\ConversationService;

class MyController extends Controller
{
    public function __construct(
        private readonly ConversationService $agent
    ) {}
}
```

---

Tables created
--------------

[](#tables-created)

TablePurpose`ai_conversations`One row per WhatsApp contact`ai_messages`Full message history per conversation

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Every ~0 days

Total

2

Last Release

46d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/91374170?v=4)[usman ahmed fathy](/maintainers/USmanFathy)[@USmanFathy](https://github.com/USmanFathy)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nexus-smart-solutions-whatsapp-ai-agent/health.svg)

```
[![Health](https://phpackages.com/badges/nexus-smart-solutions-whatsapp-ai-agent/health.svg)](https://phpackages.com/packages/nexus-smart-solutions-whatsapp-ai-agent)
```

###  Alternatives

[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.7M223](/packages/backpack-crud)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M1.0k](/packages/statamic-cms)[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

10.2k4.0k](/packages/leantime-leantime)[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[firefly-iii/data-importer

Firefly III Data Import Tool.

8055.8k](/packages/firefly-iii-data-importer)

PHPackages © 2026

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