PHPackages                             dantepiazza/laravel-chatwoot - 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. dantepiazza/laravel-chatwoot

ActiveLibrary[API Development](/categories/api)

dantepiazza/laravel-chatwoot
============================

Laravel integration for Chatwoot – webhook routing, bot workflow engine and Chatwoot API helpers.

1.0.0(2w ago)00MITPHPPHP ^8.1

Since May 24Pushed 2w agoCompare

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

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

dantepiazza/laravel-chatwoot
============================

[](#dantepiazzalaravel-chatwoot)

Laravel integration for [Chatwoot](https://www.chatwoot.com) — webhook routing, a step-based bot workflow engine and Chatwoot API helpers.

---

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

[](#requirements)

- PHP 8.1+
- Laravel 10 / 11 / 12
- [`dantepiazza/laravel-api-response`](https://github.com/dantepiazza/laravel-api-response)

---

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

[](#installation)

```
composer require dantepiazza/laravel-chatwoot
```

Publish the config file:

```
php artisan vendor:publish --tag=chatwoot-config
```

Publish the example workflow:

```
php artisan vendor:publish --tag=chatwoot-workflow
```

---

Environment variables
---------------------

[](#environment-variables)

Add these to your `.env`:

```
CHATWOOT_URL=https://app.chatwoot.com
CHATWOOT_BOT_TOKEN=
CHATWOOT_AGENT_TOKEN=
CHATWOOT_ACCOUNT_ID=
CHATWOOT_WEBHOOK_SECRET=
```

---

How it works
------------

[](#how-it-works)

### 1. Webhook route

[](#1-webhook-route)

The package registers the following route automatically:

```
POST /v1/chatwoot/{flow}?token={CHATWOOT_WEBHOOK_SECRET}

```

The `{flow}` segment is resolved to a class:

```
bot   →  App\Services\Chatwoot\BotWorkflow
orders →  App\Services\Chatwoot\OrdersWorkflow

```

You can have multiple workflows for different inboxes.

### 2. Creating a workflow

[](#2-creating-a-workflow)

A workflow is a class that extends `ChatwootProvider` and lives in `app/Services/Chatwoot/`.

The published stub (`BotWorkflow.php`) is a ready-to-run example. Here is the minimal structure:

```
namespace App\Services\Chatwoot;

use Dantepiazza\LaravelChatwoot\Services\ChatwootProvider;

class BotWorkflow extends ChatwootProvider
{
    public function __construct(array $payload)
    {
        $this->default_steps = ['welcome.start', 'finish'];

        $this->default_attributes = ['step' => 'welcome.start'];

        parent::__construct($payload);
    }

    public function run(): void
    {
        $method = 'step_' . str_replace('.', '_', $this->step);

        if (method_exists($this, $method)) {
            $this->$method();
        }
    }

    protected function step_welcome_start(): void
    {
        $this->send('Hello! How can I help you?')->stop();
    }

    protected function step_finish(): void
    {
        $this->send('Thanks! Goodbye 👋')->nextStep('welcome.start')->stop();
    }
}
```

### 3. Steps

[](#3-steps)

Every step is a method named `step_{name}` where dots in the step name become underscores:

Step nameMethod`welcome.start``step_welcome_start()``docs.start``step_docs_start()``affiliate.menu``step_affiliate_menu()`### 4. Navigating between steps

[](#4-navigating-between-steps)

```
$this->nextStep('some.step');   // saves the step to Chatwoot custom attributes
$this->stop();                  // halts execution (always call at the end of a step)
```

### 5. Sending messages

[](#5-sending-messages)

```
// Plain text
$this->send('Hello!');

// Interactive button list
$this->send('Choose an option:', [
    'Option A' => 'step.a',
    'Option B' => 'step.b',
]);
```

### 6. Actions

[](#6-actions)

A step can have a sub-state called an **action**, encoded as `step.name[action]`.

```
$this->step;   // "welcome.menu"
$this->action; // "confirm"
```

This is useful to handle confirmation flows or multi-stage interactions within the same logical step.

### 7. Built-in helpers (via `HasCommonFlows` trait)

[](#7-built-in-helpers-via-hascommonflows-trait)

#### `attach(string $message, string $cancelStep)`

[](#attachstring-message-string-cancelstep)

Manages a multi-message file-upload flow. Returns `true` once the user confirms they have finished sending files.

```
if ($this->attach('Please send your documents.', 'previous.step')) {
    // Files received
    $this->open(tags: ['support']);
}
```

#### `open(array $tags, int $team, string $message, string $nextStep)`

[](#openarray-tags-int-team-string-message-string-nextstep)

Adds tags, assigns a team, opens the conversation and notifies the user.

```
$this->open(tags: ['billing'], team: 2, message: 'An agent will contact you shortly.');
```

#### `goodbye(string $message, array $buttons)`

[](#goodbyestring-message-array-buttons)

Sends a closing message and asks if the user needs anything else.

```
$this->goodbye('Here is your info: ...', $this->buildGoodbyeButtons('welcome.menu'));
```

### 8. Other API methods

[](#8-other-api-methods)

MethodDescription`$this->status('open')`Toggle conversation status`$this->tag(['label'])`Add labels to the conversation`$this->team(1)`Assign to a team`$this->attribute('key', val)`Set a custom attribute`$this->wait(2)`Sleep N seconds (useful between messages)---

Development mode
----------------

[](#development-mode)

Set `$this->development = true` in your workflow constructor to allow the bot to respond even when a conversation is `open`. Useful when testing in Chatwoot directly. **Remove before deploying to production.**

---

Contributing
------------

[](#contributing)

1. Fork the repository from the `master` branch.
2. Create a branch for your feature or fix.
3. Follow PSR-12 coding standards.
4. Submit a pull request describing your changes.

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance96

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

17d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14875983?v=4)[Dante Piazza Quiroga](/maintainers/dantepiazza)[@dantepiazza](https://github.com/dantepiazza)

---

Top Contributors

[![dantepiazza](https://avatars.githubusercontent.com/u/14875983?v=4)](https://github.com/dantepiazza "dantepiazza (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dantepiazza-laravel-chatwoot/health.svg)

```
[![Health](https://phpackages.com/badges/dantepiazza-laravel-chatwoot/health.svg)](https://phpackages.com/packages/dantepiazza-laravel-chatwoot)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3751.2M45](/packages/tencentcloud-tencentcloud-sdk-php)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.1k1](/packages/jasara-php-amzn-selling-partner-api)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

232.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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