@@ -36,46 +36,90 @@ You must install the service provider:
3636// config/app.php
3737'providers' => [
3838 ...
39- NotificationChannels\TwilioNotifications\Provider ::class,
39+ NotificationChannels\Twilio\TwilioProvider ::class,
4040];
4141```
4242
43+ ### Setting up your Twilio account
44+
45+ Add your Twilio Account SID, Auth Token, and From Number (optional) to your ` config/services.php ` :
46+
47+ ``` php
48+ // config/services.php
49+
50+ 'twilio' => [
51+ 'account_sid' => env('TWILIO_ACCOUNT_SID'),
52+ 'auth_token' => env('TWILIO_AUTH_TOKEN'),
53+ 'from' => env('TWILIO_FROM'), // optional
54+ ]
55+ ```
56+
4357## Usage
4458
4559Now you can use the channel in your ` via() ` method inside the notification:
4660
4761``` php
48- use NotificationChannels\TwilioNotifications\Channel ;
49- use NotificationChannels\TwilioNotifications\SmsMessage ;
62+ use NotificationChannels\Twilio\TwilioChannel ;
63+ use NotificationChannels\Twilio\TwilioSmsMessage ;
5064use Illuminate\Notifications\Notification;
5165
5266class AccountApproved extends Notification
5367{
5468 public function via($notifiable)
5569 {
56- return [Channel ::class];
70+ return [TwilioChannel ::class];
5771 }
5872
5973 public function toTwilio($notifiable)
6074 {
61- return (new SmsMessage ())
75+ return (new TwilioSmsMessage ())
6276 ->content("Your {$notifiable->service} account was approved!");
6377 }
6478}
6579```
6680
67- ### Setting up your Twilio account
81+ You can also create a Twilio call:
6882
69- TODO
83+ ``` php
84+ use NotificationChannels\Twilio\TwilioChannel;
85+ use NotificationChannels\Twilio\TwilioCallMessage;
86+ use Illuminate\Notifications\Notification;
7087
71- ## Usage
88+ class AccountApproved extends Notification
89+ {
90+ public function via($notifiable)
91+ {
92+ return [TwilioChannel::class];
93+ }
7294
73- TODO
95+ public function toTwilio($notifiable)
96+ {
97+ return (new TwilioCallMessage())
98+ ->url("http://example.com/your-twiml-url");
99+ }
100+ }
101+ ```
102+
103+ In order to let your Notification know which phone are you sending/calling to, add the ` routeNotificationForTwilio ` method to your Notifiable model.
104+
105+ ``` php
106+ public function routeNotificationForTwitter()
107+ {
108+ return '+1234567890';
109+ }
110+ ```
74111
75112### Available Message methods
76113
77- TODO
114+ #### TwilioSmsMessage
78115
116+ - ` from('') ` : Accepts a phone to use as the notification sender.
117+ - ` content('') ` : Accepts a string value for the notification body.
118+
119+ #### TwilioCallMessage
120+
121+ - ` from('') ` : Accepts a phone to use as the notification sender.
122+ - ` url('') ` : Accepts an url for the call TwiML.
79123
80124## Changelog
81125
@@ -87,13 +131,13 @@ Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recen
87131$ composer test
88132```
89133
90- ## Contributing
134+ ## Security
91135
92- Please see [ CONTRIBUTING ] ( CONTRIBUTING.md ) for details .
136+ If you discover any security related issues, please email [email protected] instead of using the issue tracker .
93137
94- ## Security
138+ ## Contributing
95139
96- If you discover any security related issues, please email [email protected] instead of using the issue tracker .
140+ Please see [ CONTRIBUTING ] ( CONTRIBUTING.md ) for details .
97141
98142## Credits
99143
0 commit comments