PHPackages                             ka4ivan/laravel-notification-channel-instagram - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. ka4ivan/laravel-notification-channel-instagram

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

ka4ivan/laravel-notification-channel-instagram
==============================================

Instagram Notifications Channel for Laravel

1.3.0(9mo ago)465MITPHPPHP &gt;=8.1CI passing

Since May 15Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/ka4ivan/laravel-notification-channel-instagram)[ Packagist](https://packagist.org/packages/ka4ivan/laravel-notification-channel-instagram)[ RSS](/packages/ka4ivan-laravel-notification-channel-instagram/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (8)Used By (0)

Instagram Notifications Channel for Laravel
===========================================

[](#instagram-notifications-channel-for-laravel)

[![License](https://camo.githubusercontent.com/07be2ad829008b7c6a564c6704eb2a4f9738a9cf6a67f39c26f34198fa379f09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b61346976616e2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d696e7374616772616d2e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/ka4ivan/laravel-notification-channel-instagram)[![Build Status](https://camo.githubusercontent.com/d3efe1aff8e8f2e5ced527f5c15b48c491b7439d9b35dcb28bb6e134f116068d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6b61346976616e2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d696e7374616772616d2e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/ka4ivan/laravel-notification-channel-instagram)[![Latest Stable Version](https://camo.githubusercontent.com/83c70acceb753b444329705f6bb57279355b9a13750ab007df5274e5740797dc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61346976616e2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d696e7374616772616d2e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/ka4ivan/laravel-notification-channel-instagram)[![Total Downloads](https://camo.githubusercontent.com/b39623014426aadf98362c0c281b1459827de2e232b39158e4648c89308e2980/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61346976616e2f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c2d696e7374616772616d2e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/ka4ivan/laravel-notification-channel-instagram)

This package makes it easy to send notifications using the [Instagram Messenger](https://developers.facebook.com/docs/instagram-platform) with Laravel.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up your Instagram Bot](#setting-up-your-instagram-bot)
        - [Get Profile ID](#get-profile-id)
        - [Set config](#set-config)
        - [Set start buttons](#set-start-buttons)
- [Usage](#usage)
    - [Available Message methods](#available-message-methods)
    - [Available Button methods](#available-button-methods)
- [Contributing](#contributing)
- [License](#license)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require ka4ivan/laravel-notification-channel-instagram
```

Setting up your Instagram Bot
-----------------------------

[](#setting-up-your-instagram-bot)

### Get Profile ID

[](#get-profile-id)

```
curl -X GET "https://graph.instagram.com/me?fields=id,username&access_token=ACCESS_TOKEN"
```

### Set config

[](#set-config)

Next we need to add tokens to our Laravel configurations. Create a new Instagram section inside `config/services.php` and place the page token there:

```
// config/services.php
'instagram' => [
    'api_version' => env('INSTAGRAM_API_VERSION', '22.0'),
    'access_token' => env('INSTAGRAM_ACCESS_TOKEN', ''),
    'profile_id' => env('INSTAGRAM_PROFILE_ID', ''),
    'start_buttons' => [
        [
            'question' => 'Start',
            'payload' => 'start',
        ],
    ],
],
```

### Set start buttons

[](#set-start-buttons)

Run the command to set the start buttons

```
php artisan instagram:set-start-buttons
```

Possible options for the command

```
{--access_token= : Instagram access token}
{--profile_id= : Instagram profile ID}
{--api_version= : Instagram API version (default from config)}'
```

This command will add the [start buttons](https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/messaging-api/ice-breakers) that appear when entering the chat for the first time

[![image](https://private-user-images.githubusercontent.com/75951574/444004280-c4a1af25-df9f-4170-973c-c099678955a0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxMDY1OTAsIm5iZiI6MTc3NTEwNjI5MCwicGF0aCI6Ii83NTk1MTU3NC80NDQwMDQyODAtYzRhMWFmMjUtZGY5Zi00MTcwLTk3M2MtYzA5OTY3ODk1NWEwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAyVDA1MDQ1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNmZjhkODdkZDNjOWFlNDM0MTk1N2Y0YzYxNDk5ZTYxMDVkYTdkZmFlNzY5ZjNmNWZlZTRmNTQyODljNGViNzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.rTGhYj7oZu-YtkeY2sRybPIh3k-o47zh13maN-1dY5I)](https://private-user-images.githubusercontent.com/75951574/444004280-c4a1af25-df9f-4170-973c-c099678955a0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUxMDY1OTAsIm5iZiI6MTc3NTEwNjI5MCwicGF0aCI6Ii83NTk1MTU3NC80NDQwMDQyODAtYzRhMWFmMjUtZGY5Zi00MTcwLTk3M2MtYzA5OTY3ODk1NWEwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA0MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNDAyVDA1MDQ1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNmZjhkODdkZDNjOWFlNDM0MTk1N2Y0YzYxNDk5ZTYxMDVkYTdkZmFlNzY5ZjNmNWZlZTRmNTQyODljNGViNzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.rTGhYj7oZu-YtkeY2sRybPIh3k-o47zh13maN-1dY5I)

Usage
-----

[](#usage)

You can now use the Instagram channel in your `via()` method, inside the InvoicePaid class. The `to($recipientId)` (IGSID) method defines the Instagram user, you want to send the notification to.

```
use NotificationChannels\Instagram\InstagramChannel;
use NotificationChannels\Instagram\InstagramMessage;

use Illuminate\Notifications\Notification;

class ChannelConnected extends Notification
{
    public function via($notifiable)
    {
        return [InstagramChannel::class];
    }

    public function toInstagram($notifiable)
    {

        return InstagramMessage::create()
            ->to($notifiable->instagram_id) // Optional
            ->setApiVersion('22.0') // Optional
            ->setAccessToken('ABCD') // Optional
            ->setProfileId('abcd') // Optional
            ->text('Congratulations, the communication channel is connected');
    }
}
```

The notification will be sent from your Instagram page, whose page token you have configured earlier. Here's a screenshot preview of the notification inside the chat window.

[![image](https://private-user-images.githubusercontent.com/75951574/443808840-30cfd446-fd5f-4dd4-9705-82a820bf7295.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSI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NDAyVDA1MDQ1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE1YTM4ZmMwMGQ5NTVmMWY2NGU3NmMzYTczYjJjNWNkZTcxNjZiODhlNWIxN2RiMjdmNDBhOTgxM2FlZjVlYjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.NsFYNBIJnFhiMbqP9mIsWYiXAXIHjRL6iGQPDPGVdRI)

#### Message Examples

[](#message-examples)

##### Basic Text Message

[](#basic-text-message)

```
return InstagramMessage::create('You have just paid your monthly fee! Thanks');
```

##### Message With Attachment

[](#message-with-attachment)

```
return InstagramMessage::create()
    ->attach(AttachmentType::IMAGE, url('images/'.$this->product->id))
    ->to($notifiable->instagram_id);
```

###### Media types and specifications

[](#media-types-and-specifications)

   Media Type Supported Format Supported Size Maximum     Audio aac, m4a, wav, mp4 25MB   Image png, jpeg, gif 8MB   Video mp4, ogg, avi, mov, webm 25MB   ##### Message With Buttons

[](#message-with-buttons)

```
return InstagramMessage::create()
    ->to($notifiable->instagram_id)
    ->text('How can we help?')
    ->buttons([
        Button::create('View Website', $url)->isTypeWebUrl(),
        Button::create('Start Chatting', ['user' => $this->user->id])->isTypePostback() // Custom payload sent back to your server
    ]);
```

### Routing a message

[](#routing-a-message)

You can either send the notification by providing with the page-scoped user id of the recipient to the `to($recipientId)` (IGSID) method like shown in the above example or add a `routeNotificationForInstagram()` method in your notifiable model:

```
/**
 * Route notifications for the Instagram channel.
 *
 * @return int
 */
public function routeNotificationForInstagram()
{
    return $this->instagram_id;
}
```

### Available Message methods

[](#available-message-methods)

- `to($recipientId)`: (string) User (recipient) Instagram ID (IGSID).
- `text('')`: (string) Notification message.
- `attach($attachmentType, $url)`: (AttachmentType, string) An attachment type (IMAGE, AUDIO, VIDEO) and the url of this attachment.
- `attachMany($attachmentType, $urls)`: (AttachmentType, array) An attachment type (IMAGE, AUDIO, VIDEO) and the urls array of this attachments.
- `buttons($buttons = [])`: (array) An array of "Call to Action" buttons (Created using NotificationChannels\\Instagram\\Components\\Button::create()). You can add up to 3 buttons of one of the following types: web\_url or postback. See Button methods below for more details.
- `setApiVersion($apiVersion)`: (string) Set Default Graph API Version.
- `setAccessToken($accessToken)`: (string) Set the access token used for authenticating API requests.
- `setProfileId($profileId)`: (string) Set the Instagram profile ID for API requests.

### Available Button methods

[](#available-button-methods)

- `title('')`: (string) Button Title.
- `data('')`: (string) Button Data - It can be a web url or postback data.
- `type('')`: (string) Button Type - `web_url` or `postback`. Use `ButtonType` enumerator for guaranteeing valid values
- `isTypeWebUrl()`: Helper method to create a `web_url` type button.
- `isTypePostback()`: Helper method to create a `postback` type button.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance56

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~12 days

Recently: every ~19 days

Total

7

Last Release

293d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2686db262a5d5b2c9fc09afbff60bf7d1600cc0220bc1b90b4c90c62963d56df?d=identicon)[ka4ivan](/maintainers/ka4ivan)

---

Top Contributors

[![ka4ivan](https://avatars.githubusercontent.com/u/75951574?v=4)](https://github.com/ka4ivan "ka4ivan (58 commits)")

---

Tags

laravelinstagramnotificationslaravel-packagesocial medialaravel-notification-channelinstagram apirealtime notificationslaravel notifications channelinstagram notifications

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ka4ivan-laravel-notification-channel-instagram/health.svg)

```
[![Health](https://phpackages.com/badges/ka4ivan-laravel-notification-channel-instagram/health.svg)](https://phpackages.com/packages/ka4ivan-laravel-notification-channel-instagram)
```

###  Alternatives

[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[roomies/nexmo-voice-channel

Send Laravel notifications through a phone call

5313.8k](/packages/roomies-nexmo-voice-channel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
