I'm trying to use your plugin on laravel 5.8 and it's not working.
Closed this issue · 22 comments
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class Attendee extends Model
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'lastname', 'firstname', 'phone', 'alt_phone', 'email', 'dob', 'location', 'school', 'gender'
];
public function routeNotificationForSMS()
{
return $this->phone; // where phone is a cloumn in your users table;
}
}
This is my Model for attendees of a program.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Notifications\Notification;
use NotificationChannels\Hubtel\HubtelChannel;
use NotificationChannels\Hubtel\HubtelMessage;
class SendConfirmationSMSController extends Notification
{
public function via($notifiable)
{
return [HubtelChannel::class];
}
public function toSMS($notifiable)
{
return ( new HubtelMessage )
->from("The Program Hubb")
->content('Just Testing it out');
}
}
This is my controller that sends the SMS.
what I have realized is that the message is not being sent to the recipient.
Does it throw an exception?
I think you should also read the latest notice in the changelog section of the readme.md which talks about IP whitelisting.
Does it throw an exception?
Nah. it doesnt throw any exception. Surprisingly.
I'm developing and testing on my local machine at the moment. I haven't hosted it.
Have you published the config files? As in added the credentials to your .env
?
Have you published the config files? As in added the credentials to your
.env
?
Yes. I added the credentials to the.env files
didn't use the config file
Do you have enough sms balance in your hubtel account?
Lol Yes. GHS 10.00
Do you have enough sms balance in your hubtel account?
LoL. Yes, I do. GHS 10.00 I think.
lol
so what's the way forward?
does everything look good in my controller and model?
I tried sending the number ass both +233 and normal 020 both didn't work.
Everything looks good to me. Check your sms reports on hubtel if the messages were sent actually or try using your credentials with postman just to confirm everything works fine.
@Norris1z Is is possible that me not saving the phone numbers as "+233......" be the issue?
Because numbers in my database are saved as 020, 024, etc.
@dela-dels I created a new project to replicate the issue and it is true that the messages are not sent. In my case it was a 400 Bad Request
error. The problem is that the sender name must have no spaces and must be 11 characters
or less
From
string
REQUIRED
The sender address.Sender IDs must be 11 characters or less without spaces or 16 numbers.
Here's a link to Hubtel's
SMS documentation
https://developers.hubtel.com/reference#send-message
Feel free to submit a PR to update the README
with the necessary information.
Oh and don't forget to update the link in the Available Message methods
section in the README
as it is a dead link now.
@dela-dels I created a new project to replicate the issue and it is true that the messages are not sent. In my case, it was a
400 Bad Request
error. The problem is that the sender name must have no spaces and must be11 characters
or lessFrom string REQUIRED The sender address.Sender IDs must be 11 characters or less without spaces or 16 numbers.
So what did you do to resolve this? because changing my sender id to less than 11 characters still doesn't get the message sent
Reducing the characters worked for me
Doesn't work for me.
can I get a snippet of your implementation, please?