carropublic / carromessenger
:package_description
Installs: 64 495
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 8
Forks: 1
Open Issues: 0
Requires
- illuminate/support: ~5|~6|~7|~8
Requires (Dev)
- messagebird/php-rest-api: ^1.19
- mockery/mockery: ^1.1
- orchestra/testbench: ~3|~4
- phpunit/phpunit: ^8.0
- sempro/phpunit-pretty-print: ^1.0
- dev-master
- 3.0.1.x-dev
- 3.0.1
- 3.0.0.x-dev
- 3.0.0
- 3.0.0-beta
- 2.1.0
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0
- dev-3.0.0-beta
- dev-master_akk_add_response_logs
- dev-master-akk-add-more-info-in-logs
- dev-master-akk-fix-media-type
- dev-master-akk-remove-sending-text
- dev-master-akk-fix-file-sending
- dev-master-akk-fix-model-not-found
- dev-master-akk-fix-logging
- dev-master-fix-model-in-message-bird
- dev-master_akk_add_failed_response_and_catch
- dev-master-akk-fix-twilio-whatsapp
- dev-master-akk-added-laravel-8
- dev-master_akk_messagebird_webhook_command
- dev-master_akk_add_report_url
- dev-master_akk_remove_listener
- dev-master_akk_fix_configs
This package is not auto-updated.
Last update: 2024-11-10 21:11:22 UTC
README
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.