@@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.sent.dm](https://docs.sent.dm).
1313<!-- x-release-please-start-version -->
1414
1515```
16- composer require "sentdm/sent-dm-php 0.5 .0"
16+ composer require "sentdm/sent-dm-php 0.6 .0"
1717```
1818
1919<!-- x-release-please-end -->
@@ -28,18 +28,19 @@ Parameters with a default value must be set by name.
2828
2929use SentDm\Client;
3030
31- $client = new Client(
32- apiKey: getenv('SENT_DM_API_KEY') ?: 'My API Key',
33- senderID: getenv('SENT_DM_SENDER_ID') ?: 'My Sender ID',
34- );
31+ $client = new Client(apiKey: getenv('SENT_DM_API_KEY') ?: 'My API Key');
3532
36- $result = $client->messages->sendToPhone(
37- phoneNumber: '+1234567890',
38- templateID: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
39- templateVariables: ['name' => 'John Doe', 'order_id' => '12345'],
33+ $response = $client->messages->send(
34+ channel: ['sms', 'whatsapp'],
35+ template: [
36+ 'id' => '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
37+ 'name' => 'order_confirmation',
38+ 'parameters' => ['name' => 'John Doe', 'order_id' => '12345'],
39+ ],
40+ to: ['+14155551234', '+14155555678'],
4041);
4142
42- var_dump($result );
43+ var_dump($response->data );
4344```
4445
4546### Value Objects
@@ -61,10 +62,7 @@ use SentDm\Core\Exceptions\RateLimitException;
6162use SentDm\Core\Exceptions\APIStatusException;
6263
6364try {
64- $result = $client->messages->sendToPhone(
65- phoneNumber: '+1234567890',
66- templateID: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
67- );
65+ $response = $client->messages->send();
6866} catch (APIConnectionException $e) {
6967 echo "The server could not be reached", PHP_EOL;
7068 var_dump($e->getPrevious());
@@ -109,10 +107,14 @@ use SentDm\Client;
109107$client = new Client(requestOptions: ['maxRetries' => 0]);
110108
111109// Or, configure per-request:
112- $result = $client->messages->sendToPhone(
113- phoneNumber: '+1234567890',
114- templateID: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
115- templateVariables: ['name' => 'John Doe', 'order_id' => '12345'],
110+ $result = $client->messages->send(
111+ channel: ['sms'],
112+ template: [
113+ 'id' => '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
114+ 'name' => 'order_confirmation',
115+ 'parameters' => ['name' => 'John Doe', 'order_id' => '12345'],
116+ ],
117+ to: ['+14155551234'],
116118 requestOptions: ['maxRetries' => 5],
117119);
118120```
@@ -130,10 +132,14 @@ Note: the `extra*` parameters of the same name overrides the documented paramete
130132``` php
131133<?php
132134
133- $result = $client->messages->sendToPhone(
134- phoneNumber: '+1234567890',
135- templateID: '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
136- templateVariables: ['name' => 'John Doe', 'order_id' => '12345'],
135+ $response = $client->messages->send(
136+ channel: ['sms'],
137+ template: [
138+ 'id' => '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
139+ 'name' => 'order_confirmation',
140+ 'parameters' => ['name' => 'John Doe', 'order_id' => '12345'],
141+ ],
142+ to: ['+14155551234'],
137143 requestOptions: [
138144 'extraQueryParams' => ['my_query_parameter' => 'value'],
139145 'extraBodyParams' => ['my_body_parameter' => 'value'],
0 commit comments