- How do I install tomatophp/filament-twilio in a Laravel app?
- Install it with Composer using composer require tomatophp/filament-twilio. Then add the TWILIO_SID, TWILIO_TOKEN, and TWILIO_SENDER_NUMBER values to your .env file and run php artisan config:cache. Finally, add the InteractsWithTwilioWhatsapp trait to the model that should receive WhatsApp messages.
- What environment variables are required for filament-twilio Twilio WhatsApp?
- The package expects TWILIO_SID, TWILIO_TOKEN, and TWILIO_SENDER_NUMBER in your .env file. After setting them, clear or cache configuration with php artisan config:cache. The sender number is the Twilio WhatsApp-enabled sender used for outbound messages.
- Which Laravel and Filament versions does tomatophp/filament-twilio support?
- The provided evaluation lists support for Laravel 9.x through 10.x, Filament v2.5+ and v3.x, PHP 8.0+, and Twilio SDK ^6.0. You should still pin filament/filament to a compatible version in Composer to reduce upgrade risk. Check the repository and Packagist metadata before adopting it in a new Laravel or Filament release.
- How do I send a WhatsApp message with Filament Notification and Twilio?
- Add the InteractsWithTwilioWhatsapp trait to your User model, then call Filament's Notification facade with sendToTwilioWhatsapp. For example, Notification::make()->body('Your message')->sendToTwilioWhatsapp(user: $user) sends a WhatsApp message through Twilio. You can pass a mediaURL argument when you need to attach media.
- Can I send a Twilio WhatsApp message directly from a User model?
- Yes. After adding the trait to your User model, you can call $user->notifyTwilioWhatsapp(message: 'Your message') directly. The method also accepts a mediaURL parameter for media messages. This is a convenience wrapper around the same Twilio WhatsApp integration used by the Filament notification macro.
- How do I include an image or media URL in a Twilio WhatsApp notification?
- Pass the mediaURL argument to sendToTwilioWhatsapp or notifyTwilioWhatsapp, as shown in the README with an Unsplash image URL. The evaluation recommends validating media URLs because broken or 404 URLs can break delivery. Use publicly reachable HTTPS URLs that Twilio can fetch.
- Can I use tomatophp/filament-twilio outside Filament or in a non-Filament Laravel app?
- The package is designed around Filament's native Notification facade and is low risk for Filament-based apps. It is not a good fit for non-Filament Laravel apps, CLI tools, or standalone APIs because the notification facade integration may not be available or appropriate. For those contexts, consider a general Laravel Twilio notification channel instead.
- Does filament-twilio support SMS or multiple Twilio channels?
- No, the package is specifically for Twilio WhatsApp messages and does not provide SMS or other Twilio channels. If you need SMS fallback or multi-channel delivery, pair it with a package such as laravel-notification-channels/twilio or build separate notification channels. Plan for duplication if you need both WhatsApp and SMS.
- How should I test or mock Twilio WhatsApp notifications in Laravel?
- Mock the Twilio SDK in unit tests using Mockery or a similar mocking tool so tests do not call the real Twilio API. Test media URLs as well, since invalid or 404 URLs can cause delivery failures. Keep Twilio credentials out of tests and use fake config values where possible.
- Should I queue Twilio WhatsApp messages in production, and what are the scaling concerns?
- Yes, queue Twilio WhatsApp sends in production to avoid request timeouts and to handle Twilio's WhatsApp rate limits, which the evaluation notes can be around one message per second by default. Log Twilio errors and monitor delivery failures through Twilio's debugger or Laravel logs. For high volume, review Twilio WhatsApp Business API pricing and scaling limits.