Giter VIP home page Giter VIP logo

carro-messenger's Introduction

CarroMessenger

Latest Version on Packagist Total Downloads

You can send WhatsApp messages and template message using Message bird and Twilio, SMS messages using Twilio and Telerivet using this package. You can create webhooks for programmable webhooks of Toky to handle incoming phone calls.

You need to prepare an array with service and channel (WhatsApp, SMS, etc) which you would like to use. Then call the sendMessage(). You can see an example in the following

$data = [
    'to'        => '+959XXXXXXXX',
    'message'   => 'Testing',
    'service'   => 'twilio',
    'channel'   => 'whatsapp',
    'image_url' => 'www.example.com/example.jpg'
];
CarroMessenger::sendMessage($data);

Installation

Via Composer

$ composer require carropublic/carromessenger

Usage

You need to set .env values for each service that you would like to use.

#For Message Bird
MESSAGE_BIRD_ACCESS_KEY                     = message_bird_key
MESSAGE_BIRD_WHATS_APP_CHANNEL_ID           = whatsapp_channel_from_message_bird
MESSAGE_BIRD_WHATSAPP_TEMPLATE_NAMESPACE    = whatsapp_tempalate_namespace (only needed it you would like to send template message)
MESSAGE_BIRD_WHATSAPP_REPORT_URL            = whatsapp_message_status_report_url (optional)
MESSAGE_BIRD_WHATSAPP_PHONE                 = whatsapp_message_bird_phone // (optional)

#For Twilio
TWILIO_ACCOUNT_SID              = twilio_account_sid
TWILIO_AUTH_TOKEN               = twilio_auth_token

#For Telerivet
TELERIVET_API_KEY               = telerivet_api_key
TELERIVET_PROJECT_ID            = telerivet_project_id

#For Toky
TOKY_APP_KEY                    = toky_app_key
TOKY_APP_URL                    = toky_app_url

Then, create an array to send out the message like the following. It's as simple as that.

$data = [
    'to'        => '+959XXXXXXXX',
    'message'   => 'Testing',
    'service'   => 'twilio',
    'channel'   => 'whatsapp',
    'image_url' => 'www.example.com/example.jpg'
];
CarroMessenger::sendMessage($data);

The following services support for the error message and status report with programmable webhooks. You can read about each individual one by clicking the following list.

For other services that are not listed above, you may need to rely on events.

Events

We are extending the Laravel's Notification to sent messages. Therefore, you can't see the success/error with an immediate response. In order to resolve this, we added an event name call MessageWasSent. The package will be sent to an event every time you sent the messages. But, you have to set EVENT_IS_CALLED as true in your .env. Then, you create a listener for that event and handle the result as your needs. You can also use Laravel's Notification Event as well.

Security

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

Credits

License

license. Please see the license file for more information.

carro-messenger's People

Contributors

aungkoko avatar setkyar avatar

Watchers

James Cloos avatar Daniel Nguyen avatar  avatar Yih Yang avatar Phạm Minh Đạt avatar  avatar  avatar Patricio Silva avatar

Forkers

ertprs

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.