Skip to content

Commit c21adf8

Browse files
committed
Upgrade to new api
1 parent e3ceced commit c21adf8

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/Client.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Client
99
protected $username;
1010
protected $password;
1111
protected $client;
12-
protected $endpoint = 'https://api.mobtexting.com/v1/sms';
12+
protected $endpoint = 'https://portal.mobtexting.com/api/v2/sms/send';
1313

1414
/**
1515
* Mobtexting constructor.
@@ -21,13 +21,13 @@ public function __construct($username, $password = null, $client = null)
2121
{
2222
$this->username = $username;
2323
$this->password = $password;
24-
$this->client = $client ?: new HttpClient($this->endpoint);
24+
$this->client = $client ?: new HttpClient($this->endpoint);
2525
}
2626

2727
public function send($to, $params = [])
2828
{
29-
$to = is_array($to) ? implode(',', $to) : $to;
30-
$params['to'] = $to;
29+
$to = is_array($to) ? implode(',', $to) : $to;
30+
$params['to'] = $to;
3131
$params['token'] = $this->getToken();
3232

3333
$params = $this->map($params);
@@ -38,10 +38,10 @@ public function send($to, $params = [])
3838
protected function map($params = [])
3939
{
4040
$mapping = [
41-
'token' => 'api_key',
42-
'text' => 'message',
43-
'to' => 'mobile_no',
44-
'from' => 'sender_id',
41+
'token' => 'access_token',
42+
'text' => 'message',
43+
'to' => 'to',
44+
'from' => 'sender',
4545
];
4646

4747
foreach ($params as $key => $val) {

0 commit comments

Comments
 (0)