jeffersongoncalves/laravel-whatsapp-widget

This Laravel package provides a simple yet customizable WhatsApp widget for your website. It allows you to easily add a clickable WhatsApp button or floating widget to connect visitors directly with your WhatsApp account. The widget is designed to be easily integrated into your Laravel application a

Installs: 1 440

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

Language:CSS

pkg:composer/jeffersongoncalves/laravel-whatsapp-widget

v1.4.0 2025-12-27 20:09 UTC

This package is auto-updated.

Last update: 2026-01-07 17:59:02 UTC


README

Laravel Whatsapp Widget

Laravel Whatsapp Widget

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This Laravel package provides a simple yet customizable WhatsApp widget for your website. It allows you to easily add a clickable WhatsApp button or floating widget to connect visitors directly with your WhatsApp account. The widget is designed to be easily integrated into your Laravel application and is fully customizable to match your website's design.

Features

  • ๐Ÿš€ Multi-agent support: Add multiple WhatsApp agents with different phone numbers and names
  • ๐ŸŽจ Customizable appearance: Change the widget's position, colors, and text
  • ๐Ÿ”Š Audio notifications: Optional sound alert when the widget loads (configurable)
  • ๐Ÿ“ฑ Mobile-friendly: Responsive design that works on all devices
  • ๐ŸŒ Localization support: Easily translate the widget to any language
  • ๐Ÿ”„ Pre-defined messages: Set default text messages for each agent
  • ๐Ÿ–ผ๏ธ Custom agent avatars: Add profile pictures for each agent

Screenshots

Widget Position: Right (Default)

Closed Open
Widget Position Right Widget Position Right Open

Widget Position: Left

Closed Open
Widget Position Left Widget Position Left Open

Redirect Page

Redirect Page

Requirements

  • PHP 8.2 or higher
  • Laravel 11.0 or higher

Installation

You can install the package via composer:

composer require jeffersongoncalves/laravel-whatsapp-widget

Usage

1. Publish the package assets

Publish config file:

php artisan vendor:publish --tag=whatsapp-widget-config

Publish migration file:

php artisan vendor:publish --tag=whatsapp-widget-migrations

Publish assets files:

php artisan vendor:publish --tag=whatsapp-widget-assets

Publish translations files:

php artisan vendor:publish --tag=whatsapp-widget-translations

Publish views files:

php artisan vendor:publish --tag=whatsapp-widget-views

2. Run the migrations

php artisan migrate

3. Add the widget to your layout

Add the head template in your layout's <head> section:

@include('whatsapp-widget::whatsapp-widget-head')

Add the body template before the closing </body> tag:

@include('whatsapp-widget::whatsapp-widget-body')

4. Add WhatsApp agents

You need to add WhatsApp agents to your database. You can do this through your application's admin panel or by creating a seeder.

Example seeder:

use JeffersonGoncalves\WhatsappWidget\Models\WhatsappAgent;

WhatsappAgent::create([
    'active' => true,
    'name' => 'Customer Support',
    'phone' => '+1234567890',
    'text' => 'Hello! I have a question about your product.',
    'image' => 'path/to/agent-avatar.jpg', // Optional
]);

Configuration

After publishing the configuration file, you can customize the widget by editing the config/whatsapp-widget.php file:

return [
    // Enable or disable audio notification
    'audio' => true,

    // Play audio notification once per day or on every page load
    'play_audio_daily' => true,

    // Filesystem disk for storing agent images
    'disk' => env('FILESYSTEM_DISK', 'local'),

    // Application URL (used for redirection)
    'url' => env('APP_URL', 'http://localhost'),

    // Application name (displayed in the widget)
    'name' => env('APP_NAME', 'Laravel App'),

    // WhatsApp API key (if needed)
    'key' => env('WHATSAPP_KEY'),

    // Widget position on the screen (left or right)
    'position' => 'right',
];

Customization

Translations

The package currently supports the following languages:

  • ๐Ÿ‡ธ๐Ÿ‡ฆ Arabic (ar)
  • ๐Ÿ‡จ๐Ÿ‡ฟ Czech (cs)
  • ๐Ÿ‡ฉ๐Ÿ‡ช German (de)
  • ๐Ÿ‡บ๐Ÿ‡ธ English (en)
  • ๐Ÿ‡ช๐Ÿ‡ธ Spanish (es)
  • ๐Ÿ‡ฎ๐Ÿ‡ท Persian (fa)
  • ๐Ÿ‡ซ๐Ÿ‡ท French (fr)
  • ๐Ÿ‡ฎ๐Ÿ‡ฑ Hebrew (he)
  • ๐Ÿ‡ฎ๐Ÿ‡ฉ Indonesian (id)
  • ๐Ÿ‡ฎ๐Ÿ‡น Italian (it)
  • ๐Ÿ‡ฏ๐Ÿ‡ต Japanese (ja)
  • ๐Ÿ‡ณ๐Ÿ‡ฑ Dutch (nl)
  • ๐Ÿ‡ต๐Ÿ‡ฑ Polish (pl)
  • ๐Ÿ‡ต๐Ÿ‡น Portuguese (pt)
  • ๐Ÿ‡ง๐Ÿ‡ท Portuguese (Brazil) (pt_BR)
  • ๐Ÿ‡ต๐Ÿ‡น Portuguese (Portugal) (pt_PT)
  • ๐Ÿ‡ธ๐Ÿ‡ฐ Slovak (sk)
  • ๐Ÿ‡น๐Ÿ‡ท Turkish (tr)

You can customize the widget's text by editing the translation files in resources/lang/vendor/whatsapp-widget/.

Position

By default, the widget appears in the bottom-right corner of the page. You can change this by modifying the position value in the config/whatsapp-widget.php file.

Example for left position:

'position' => 'left',
Closed Open
Widget Position Left Widget Position Left Open

Example for right position:

'position' => 'right',
Closed Open
Widget Position Right Widget Position Right Open

Redirect Page

When a user clicks on an agent, they are redirected to a temporary page before being sent to WhatsApp. This page can be customized by publishing the package views.

Redirect Page

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.