ka4ivan/laravel-notification-channel-instagram
Pros:
InstagramMessage and Button classes allow for granular customization (e.g., dynamic payloads, conditional attachments) without monolithic changes.Cons:
Low-Effort Path:
Notification::send($user, new InstagramMessage())).Button, AttachmentType, and InstagramChannel classes to avoid reinventing API wrappers.config/services.php).High-Effort Path:
InstagramMessage to support non-standard API responses (e.g., carousel messages, interactive menus).env() or a secrets manager) to mitigate risks of token leakage.set-start-buttons command may fail if Facebook alters the /me/messaging_profiles endpoint.config/services.php (plaintext) and passed in notification payloads. Mitigation requires:
env() for tokens.Button::create()) could expose the app to injection risks if not sanitized.Notification::route()) with a failed job handler.failed_jobs table + monitoring).Laravel Compatibility:
database, redis), reducing API load and improving reliability.NotificationFake) for unit/feature tests.Third-Party Dependencies:
facebook/graph-sdk under the hood. Ensure version compatibility (e.g., ^5.0 for Laravel 8+).cURL extension (enabled by default in Laravel).Database Requirements:
instagram table in config/services.php). No additional migrations required.Pre-Integration:
https://your-app.com as a Valid OAuth Redirect URI.17841417323383883).composer require ka4ivan/laravel-notification-channel-instagram
php artisan vendor:publish --provider="NotificationChannels\Instagram\InstagramServiceProvider"
config/services.php with Instagram credentials:
'instagram' => [
'api_version' => env('INSTAGRAM_API_VERSION', 'v18.0'),
'access_token' => env('INSTAGRAM_ACCESS_TOKEN'),
'profile_id' => env('INSTAGRAM_PROFILE_ID'),
],
Core Integration:
Notification class to use the Instagram channel:
use NotificationChannels\Instagram\InstagramChannel;
use NotificationChannels\Instagram\InstagramMessage;
class ChannelConnected extends Notification
{
public function via($notifiable)
{
return [InstagramChannel::class];
}
public function toInstagram($notifiable)
{
return InstagramMessage::create()
->to($notifiable->instagram_id)
->text('Your channel is now connected!');
}
}
routeNotificationForInstagram() to your User model:
public function routeNotificationForInstagram()
{
return $this->instagram_id; // Store this in your DB
}
Or pass the ID dynamically:
Notification::send($user, new ChannelConnected(), via: [InstagramChannel::class]);
Advanced Features:
return InstagramMessage::create()
->attach(AttachmentType::IMAGE, 'https://example.com/image.jpg')
->to($notifiable
How can I help you explore Laravel packages today?