Coder Social home page Coder Social logo

intercom's Introduction

Intercom notifications channel for Laravel

Latest Version on Packagist Software License Build Status StyleCI Quality Score Code Coverage Total Downloads

This package makes it easy to send notifications using Intercom with Laravel.

Contents

Installation

You can install the package via composer:

composer require laravel-notification-channels/intercom

Setting up the Intercom service

Add the followings to your config/services.php

'intercom' => [
    'token' => env('INTERCOM_API_KEY')
]

Add your Intercom Token to .env

INTERCOM_API_KEY=xxx

Usage

Now you can use the channel in your via() method inside the notification:

use NotificationChannels\Intercom\IntercomChannel;
use NotificationChannels\Intercom\IntercomMessage;
use Illuminate\Notifications\Notification;

class TestNotification extends Notification
{
    public function via($notifiable)
    {
        return ["intercom"];
    }

    public function toIntercom($notifiable): IntercomMessage
    {
        return IntercomMessage::create("Hey User!")
            ->from(123)
            ->toUserId(321);
    }
}

Available methods

  • body(''): Accepts a string value for the Intercom message body
  • email(): Accepts a string value for the Intercom message type email
  • inapp(): Accepts a string value for the Intercom message type inapp (default)
  • subject(''): Accepts a string value for the Intercom message body (using with email type)
  • plain(): Accepts a string value for the Intercom message plain template
  • personal(): Accepts a string value for the Intercom message personal template
  • from('123'): Accepts a string value of the admin's id (sender)
  • to(['type' => 'user', 'id' => '321']): Accepts an array value for the recipient data
  • toUserId(''): Accepts a string value for the Intercom message user by id recipient
  • toUserEmail(''): Accepts a string value for the Intercom message user by email recipient
  • toContactId(''): Accepts a string value for the Intercom message contact by id recipient

More info about fields read in Intercom API Reference

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

intercom's People

Contributors

atymic avatar ftw-soft avatar simoneu01 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.