Overview
In this guide, we will cover how to handle incoming WhatsApp webhooks and events using the Hypersender Laravel SDK. Webhooks are a powerful way to receive real-time updates from WhatsApp, allowing your application to respond to messages, status changes, and other events as they happen.Setting Up Webhooks
- The package auto-registers a POST route (default /whatsapp/webhook).
- Verifies the signature using the secret in config/env.
- Dispatches a dedicated Laravel event for each webhook event type (e.g., MessagesUpserted, GroupsUpdated, etc.).
- Listen for events in your app:
See the Webhook Usage in it’s dedicated section for more details webhook usage.
Available Webhook Events
The following events are available for handling WhatsApp webhooks:Hypersender\Events\Whatsapp\PresenceUpdateHypersender\Events\Whatsapp\MessagesAnyHypersender\Events\Whatsapp\MessageReactionHypersender\Events\Whatsapp\MessagesAckHypersender\Events\Whatsapp\MessagesWaitingHypersender\Events\Whatsapp\MessagesRevokedHypersender\Events\Whatsapp\PollVoteHypersender\Events\Whatsapp\PollVoteFailed
Customizing the Webhook Route
To customize the webhook route, you can publish the package’s configuration file and modify thewebhook_route setting:
whatsapp_webhook_route in config/hypersender-config.php: