Sendzen API Documentation
HomeGetting Started
HomeGetting Started
Visit Website
Sign In
Create an account
  1. Programming Languages
  • Start Guide
    • Getting Started
    • API Reference
  • Messages
    • Template Messages
      • Send Text Message
      • Send Interactive Message
      • Send Media Message
    • Session Messages
      • Send Text Message
      • Send Image Message
      • Send Video Message
      • Send Audio Message
      • Send Document Message
      • Send Interactive Reply Message
    • Incoming Messages
      • Received Text Message
      • Received Message with Reaction
      • Received Media Message with Image
      • Received Callback from a Quick Reply Button Click
  • Template
    • List Templates
      GET
    • Create Template
      POST
    • Delete Template
      DELETE
  • Project
    • Create Project
      POST
    • List Projects
      GET
    • Update Project
      PUT
    • Retrieve Project
      GET
  • WABA
    • List WABA
      GET
    • Retrieve WABA Details from Meta
      GET
    • Retrieve WhatsApp Business Profile Detail
      GET
    • Update WhatsApp Business Profile
      POST
  • Activity Logs
    • All Event Logs
    • Incoming Message Logs
    • Message Status Logs
    • Other Event Logs
    • Multiple Event Types
  • Knowledge Base
    • Programming Languages
      • Python
      • Node.js
      • PHP
      • Laravel
      • Java
      • C# .NET
    • Onboarding
      • WhatsApp Setup
  • Schemas
    • Schemas
      • Template Message
      • Url
      • 401/403 Message Response
      • AccountLoginRequest
      • APIKeyDto
      • Address
      • Account
      • AccountRegisterRequest
      • CommonResponse
      • AccountDetailDto
      • CreateOrUpdateProjectRequest
      • Contact
      • Error
      • PartnerConfigDto
      • ContactName
      • Button
      • ErrorResponse
      • CarouselCard
      • LoginResponse
      • Email
      • PartnerInfoDto
      • Component
      • ProjectDetailDto
      • ProjectWABADetail
      • Interactive
      • WABADetail
      • WABASignUp
      • InteractiveAction
      • WABADto
      • InteractiveBody
      • CreateTemplateRequest
      • InteractiveButton
      • InteractiveFooter
      • InteractiveHeader
      • InteractiveMedia
      • Example
      • InteractiveProductItem
      • InteractiveProductSection
      • InteractiveReply
      • InteractiveRow
      • InteractiveSection
      • Location
      • Media
      • MessageRequest
      • MessageResponse
      • MessageTemplate
      • Organization
      • LimitedTimeOffer
      • Phone
      • Reaction
      • Response
      • TemplateAction
      • NamedParameter
      • TemplateButtons
      • OrderCheckoutDto
      • TemplateCarousel
      • OrderDto
      • TemplateComponent
      • OrderStatusEnum
      • TemplateCurrency
      • TemplateDateTime
      • PaymentGatewayDto
      • TemplateLimitedTimeOffer
      • TemplateMedia
      • TemplateParameter
      • TemplateProductItem
      • TemplateSection
      • TemplateTapTargetConfiguration
      • SupportedApp
      • Text
      • WhatsAppBusinessProfile
      • UploadMedia
    • Knowledge Base
  1. Programming Languages

WhatsApp API with Laravel

This guide provides everything you need to send messages, build bots, and automate communication using the WhatsApp API Laravel (also known as Laravel WhatsApp API). We'll provide production-ready code examples and best practices using SendZen.io to ensure a world-class developer experience.
Whether you want to send WhatsApp message Laravel from your application or build a sophisticated Laravel WhatsApp chatbot, you're in the right place. Unofficial libraries that rely on web scraping are unreliable and will get your number banned. Using the official WhatsApp Business API Laravel is the only stable and scalable method for professional applications.
SendZen makes the WhatsApp API integration Laravel incredibly simple. This guide covers everything from basic messaging to building complete Laravel WhatsApp bots and Laravel WhatsApp integration. Let's dive in.
This guide covers:
Send WhatsApp message Laravel - Complete API integration examples.
WhatsApp API integration in Laravel - Receiving messages programmatically.
Laravel WhatsApp bot - Build interactive bots from scratch.
Laravel WhatsApp cloud API - Production-ready code examples.
Best practices for production, including Laravel WhatsApp integration.

Prerequisites#

Before you start, you'll need:
1.
PHP 8.1+ installed.
2.
Laravel 10+ installed.
3.
A free SendZen.io Account to get your API Key.
4.
Install Laravel if you haven't already:

Part 1: How to Send a WhatsApp Message with Laravel#

Sending a transactional message programmatically, like an order confirmation or a 2FA code, is a core use case. This guide shows you how to send WhatsApp message Laravel using the official WhatsApp API Laravel. Laravel's built-in HTTP client makes Laravel send WhatsApp message incredibly simple. This demonstrates WhatsApp API integration Laravel best practices.
Create a service class app/Services/WhatsAppService.php:
Add to config/services.php:
Add to .env:
SENDZEN_API_TOKEN=YOUR_API_TOKEN
Usage Example (routes/web.php or in a controller):
You've just successfully sent an automated WhatsApp message using Laravel! This simple service demonstrates how to send WhatsApp message Laravel and is the foundation for all outbound messaging using the Laravel WhatsApp API. This Laravel send WhatsApp message implementation can be easily integrated into your Laravel application.

Part 2: Receiving Messages with a Laravel Webhook#

To build a Laravel WhatsApp bot or create a Laravel WhatsApp chatbot, your application needs to listen for incoming messages. The WhatsApp API Laravel does this using webhooks. When a user messages your number, WhatsApp sends the message data as a JSON POST request to a URL you specify.
Create a controller to handle webhooks. This demonstrates Laravel WhatsApp integration and how to receive messages using WhatsApp API integration in Laravel.
1. Create Webhook Controller (app/Http/Controllers/WhatsAppWebhookController.php):
2. Add Route (routes/web.php):
To make this work:
1.
Run the Laravel App: php artisan serve. Your server is now running on localhost:8000.
2.
Expose to the Web: WhatsApp can't reach localhost. Use a tool like ngrok to create a public URL for your local server:
3.
Configure the Webhook: Copy the https://....ngrok.io URL provided by ngrok, append your route (/webhooks/whatsapp), and paste it into the Webhook URL field in your SendZen dashboard.
Now, when you send a message to your WhatsApp number, you'll see the message data logged in Laravel's log files (storage/logs/laravel.log).

Part 3: Building a Complete WhatsApp Bot in Laravel#

Let's combine what we've learned to create a simple but complete Laravel WhatsApp bot. This Laravel WhatsApp chatbot will reply to specific keywords, demonstrating a full WhatsApp bot API Laravel implementation.
We'll update our controller to use the WhatsAppService. This example shows how to build a Laravel WhatsApp bot from scratch using WhatsApp API integration Laravel.
Run this updated Laravel application with ngrok again. Now, when you send "hello" or "status" to your WhatsApp number, the bot will reply automatically! This is the foundation for all WhatsApp automation with Laravel and demonstrates how to send WhatsApp message Laravel programmatically.
This implementation uses the WhatsApp Cloud API Laravel for reliable messaging and shows Laravel WhatsApp integration best practices. You can extend this to create a full Laravel WhatsApp chatbot or Laravel WhatsApp chat system.

Advanced Topics & Best Practices#

Scaling Up: Laravel WhatsApp Bulk Sender#

To send bulk messages programmatically, such as alerts to all your users, use Laravel's Job Queue for better performance and reliability. This demonstrates how to send WhatsApp message Laravel at scale using WhatsApp API integration Laravel.
1. Create a Job (app/Jobs/SendWhatsAppMessage.php):
2. Dispatch Jobs:
Important: To initiate conversations with users, WhatsApp requires you to use pre-approved Message Templates. This is a crucial policy to prevent spam. You can easily manage and send templates via the SendZen API. For bulk campaigns, use templates.

Using Laravel Events#

For more complex bot logic, use Laravel events to decouple your code:
1. Create an Event (app/Events/WhatsAppMessageReceived.php):
2. Create a Listener (app/Listeners/ProcessWhatsAppMessage.php):
3. Register the Listener (app/Providers/EventServiceProvider.php):
4. Dispatch Event in Controller:

Webhook Security#

Add middleware to validate webhook signatures:
1. Create Middleware (app/Http/Middleware/ValidateWhatsAppWebhook.php):
2. Apply Middleware (app/Http/Kernel.php):
3. Apply to Route:

Using Laravel Notifications#

For sending notifications (like order confirmations), use Laravel's notification system. This enables Laravel notification WhatsApp functionality and shows how to send WhatsApp message using Laravel through Laravel's built-in notification system:
1. Create Notification (app/Notifications/WhatsAppNotification.php):
2. Usage:

Database Logging#

Store incoming messages in the database for analytics:
1. Create Migration:
2. Create Model (app/Models/WhatsAppMessage.php):
3. Save in Controller:

Twilio WhatsApp Laravel Alternative#

While this guide focuses on SendZen's WhatsApp API Laravel integration, some developers also use Twilio WhatsApp Laravel or Twilio Laravel WhatsApp. However, SendZen provides a more streamlined Laravel WhatsApp API experience with better WhatsApp API integration Laravel features.

Laravel WhatsApp Gateway#

For enterprise applications, you can set up a Laravel WhatsApp gateway using the service pattern demonstrated in this guide. This creates a robust WhatsApp gateway Laravel solution that can handle high volumes of messages.

Laravel WhatsApp Server#

You can also deploy this as a dedicated Laravel WhatsApp server by running it on a separate server instance. This allows you to scale your WhatsApp API Laravel infrastructure independently.

Additional Resources#

WhatsApp API Laravel GitHub Examples#

Looking for more examples? Check out WhatsApp API Laravel repositories for additional code samples, integrations, and community contributions. Our implementation demonstrates how to use the WhatsApp Cloud API Laravel effectively.

Key Features Covered#

✅ Send WhatsApp message Laravel - Complete API integration
✅ WhatsApp API send message Laravel - Production-ready code
✅ Laravel send WhatsApp message - Simple and reliable
✅ Laravel WhatsApp bot - Full bot implementation
✅ Laravel WhatsApp gateway - Enterprise-ready solution
✅ WhatsApp API integration Laravel - Best practices included
✅ Laravel WhatsApp integration - Framework integrations
✅ Laravel WhatsApp chatbot - AI-powered bot examples

Common Questions#

Q: How do I send WhatsApp message using Laravel?
A: Use the WhatsAppService class provided in Part 1. It uses Laravel's HTTP client to send messages via the WhatsApp API Laravel.
Q: How to integrate WhatsApp API in Laravel?
A: Follow Part 1 to integrate WhatsApp API in Laravel. The service class demonstrates WhatsApp API integration Laravel best practices.
Q: How do I send WhatsApp message Laravel?
A: Use the sendMessage method from the WhatsAppService class to send WhatsApp message Laravel. See Part 1 for complete examples.
Q: How to create a Laravel WhatsApp bot?
A: Follow Part 3 to create a Laravel WhatsApp bot. It shows you how to build a complete Laravel WhatsApp chatbot.
Q: Can I use Twilio WhatsApp Laravel instead?
A: While you can use Twilio WhatsApp Laravel or Twilio Laravel WhatsApp, SendZen provides a more streamlined Laravel WhatsApp API experience.
Q: How do I send WhatsApp message using Laravel 8?
A: This guide works with Laravel 8+ and shows how to send WhatsApp message using Laravel 8. The code examples are compatible with Laravel 8, 9, and 10+.
Q: How to set up Laravel WhatsApp integration?
A: Follow Parts 1 and 2 to set up Laravel WhatsApp integration. The guide covers WhatsApp API integration in Laravel step by step.
Q: Can I use Laravel notifications for WhatsApp?
A: Yes! Use the Laravel notification WhatsApp examples in the Advanced Topics section to send WhatsApp messages through Laravel's notification system.
Q: How do I send WhatsApp message API Laravel?
A: Use the WhatsAppService class to send WhatsApp message API Laravel. It handles all API communication for you.
Q: What's the difference between WhatsApp Cloud API Laravel and WhatsApp Web API Laravel?
A: Both refer to the official WhatsApp Business API Laravel. The WhatsApp Cloud API Laravel is the cloud-hosted version used in this guide.
Q: How to set up Laravel WhatsApp gateway?
A: Use the service pattern demonstrated in this guide to create a Laravel WhatsApp gateway. It provides a clean interface for WhatsApp API integration Laravel.
Q: Can I deploy this as a Laravel WhatsApp server?
A: Yes, you can deploy this as a dedicated Laravel WhatsApp server by running it on a separate server instance for better scalability.
Q: How do I send WhatsApp message Laravel programmatically?
A: Use the sendMessage method from WhatsAppService to send WhatsApp message Laravel programmatically. See Part 1 for examples.
Q: Is there WhatsApp API Laravel example code?
A: Yes, this entire guide provides WhatsApp API Laravel example code that you can use directly in your Laravel projects.
Q: How to implement Laravel WhatsApp chat?
A: Follow Parts 2 and 3 to implement Laravel WhatsApp chat functionality. The webhook controller handles incoming messages.
Q: Can I use Laravel WhatsApp Business API?
A: Yes, this guide demonstrates how to use the WhatsApp Business API Laravel and Laravel WhatsApp Business API through SendZen.
Q: How do I send WhatsApp message Laravel from controller?
A: Inject the WhatsAppService into your controller and call sendMessage(). See Part 3 for complete examples.
Q: Is there WhatsApp chat API Laravel support?
A: Yes, this guide shows how to use the WhatsApp chat API Laravel for both sending and receiving messages.

Start Building Now#

You now have a complete toolkit for WhatsApp API programming in Laravel. By combining Laravel's HTTP client, service classes, queues, and events, you can build powerful, automated communication workflows that scale.
Whether you're building a Laravel WhatsApp bot, integrating the WhatsApp API Laravel into your application, setting up Laravel WhatsApp integration, or creating a Laravel WhatsApp chatbot, SendZen makes it simple.
With SendZen's developer-first Laravel WhatsApp API solution, you can stop wrestling with complex setups and focus on creating amazing applications. Use this guide to integrate WhatsApp API in Laravel, send WhatsApp message Laravel, and build robust WhatsApp API integration Laravel solutions.
Sign Up for Free & Get Your API Key →
Modified at 2025-11-04 09:11:19
Previous
PHP
Next
Java
Built with