Coder Social home page Coder Social logo

alhaji-aki / helliomessaging-laravel-notification-channel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from helliosolutions/helliomessaging-laravel-notification-channel

0.0 1.0 0.0 60 KB

Hellio Messaging SMS Notification Channel for Laravel Intended for 5.3 and up.

License: MIT License

PHP 100.00%

helliomessaging-laravel-notification-channel's Introduction

Hellio Messaging Laravel Notification Channel

Latest Stable Version Total Downloads License

This package makes it easy to send notifications using Hellio Messaging

Content

Installation

To get the latest version of Hellio Messaging Notification channel is intended for Laravel 5.5 and up, simply require the project using Composer:

composer require helliomessaging/helliomessaging-laravel-notification-channel

If you use Laravel 5.5+ you don't need the following step. If not, once package is installed, you need to register the service provider. Open up config/app.php and add the following to the providers key.

  • NotificationChannels\Hellio\HellioServiceProvider::class

Setting up the Hellio Messaging Service

First, you must have an account with Hellio. Once you've registered for an account, login into your account and click on the Profile & API Integration menu on your Hellio Messaging dashboard. Click on the API Keys & Webhooks tab and copy your Client ID and Application Secret

In your terminal run

php artisan vendor:publish --provider="NotificationChannels\Hellio\HellioServiceProvider"

This creates a hellio.php file in your config directory.

Paste your api keys in the config/hellio.php configuration file. You may copy the example configuration below to get started:

<?php

return [
    'config' => [
        'client_id' => env('HELLIO_CLIENT_ID'),
        'app_secret' => env('HELLIO_APP_SECRET')
    ],

];

Or

Add the HELLIO_CLIENT_ID and HELLIO_APP_SECRET to your .env file

Usage

Now you can use the channel in your via() method in any notification you want to send using Hellio Messaging:

<?php

use Illuminate\Notifications\Notification;
use NotificationChannels\Hellio\HellioChannel;
use NotificationChannels\Hellio\HellioMessage;

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

    public function toHellioSMS($notifiable)
    {
        return (new HellioMessage)
   ->from("HellioSMS")
   ->to("233242813656") //Add the country code to the number you wish to send to without the need to add the  +
              ->content("Welcome to Hellio Messaging, a new world of litmitless possibilities.")
              ->messageType(0); //0 = text, 1 = flash
    }
}

In order to let your Notification know which phone number you are sending to, add the routeNotificationForHellioSMS method to your Notifiable model e.g your User Model

public function routeNotificationForHellioSMS()
{
    return $this->phone; // where phone is a column in your users table;
}

Available Message methods

  • from($from) : set the sender's id
  • senderID($id): an alias for from($from)
  • to($to) : set the recipient's phone number
  • msisdn($msisdn): an alias for to($to)
  • messageType($messageType): an alias for type($type)
  • content($content) : set the message content
  • message($message): an alias for content($content)

Read more about the available methods on the Hellio Messaging Documentation Portal

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.

helliomessaging-laravel-notification-channel's People

Contributors

alhaji-aki avatar helliomessaging avatar norris1z avatar vimkanzogh avatar

Watchers

 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.