Skip to content

Commit 7a00998

Browse files
authored
Merge pull request #82 from sendpulse/change_readme
Change readme
2 parents e1a81e2 + 36771e3 commit 7a00998

File tree

1 file changed

+70
-2
lines changed

1 file changed

+70
-2
lines changed

README.md

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ composer require sendpulse/rest-api
3232
require 'vendor/autoload.php';
3333

3434
// Without Composer (and instead of "require 'vendor/autoload.php'"):
35-
// require("your-path/sendpulse-rest-api-php/src/ApiInterface.php");
35+
// require("your-path/sendpulse-rest-api-php/src/Contracts/ApiInterface.php");
3636
// require("your-path/sendpulse-rest-api-php/src/ApiClient.php");
37-
// require("your-path/sendpulse-rest-api-php/src/Storage/TokenStorageInterface.php");
37+
// require("your-path/sendpulse-rest-api-php/src/Contracts/TokenStorageInterface.php");
3838
// require("your-path/sendpulse-rest-api-php/src/Storage/FileStorage.php");
3939
// require("your-path/sendpulse-rest-api-php/src/Storage/SessionStorage.php");
4040
// require("your-path/sendpulse-rest-api-php/src/Storage/MemcachedStorage.php");
@@ -181,6 +181,7 @@ try {
181181
]);
182182
}
183183

184+
184185
/*
185186
* Example: Start Automation360 event
186187
*/
@@ -207,5 +208,72 @@ try {
207208
]);
208209
}
209210

211+
212+
/**
213+
* Example: Crm create a new deal
214+
*/
215+
try {
216+
$crmCreateDeal = $apiClient->post('crm/v1/deals', [
217+
"pipelineId" => 0,
218+
"stepId" => 0,
219+
"responsibleId" => 0,
220+
"name" => "string",
221+
"price" => 0,
222+
"currency" => "string",
223+
"sourceId" => 0,
224+
"contact" => [
225+
0
226+
],
227+
"attributes" => [
228+
[
229+
"attributeId" => 0,
230+
"value" => "string"
231+
]
232+
],
233+
"attachments" => [
234+
"https://link-to-file.com/file.jpg"
235+
]
236+
]);
237+
238+
var_dump($crmCreateDeal);
239+
} catch (ApiClientException $e) {
240+
var_dump([
241+
'message' => $e->getMessage(),
242+
'http_code' => $e->getCode(),
243+
'response' => $e->getResponse(),
244+
'curl_errors' => $e->getCurlErrors(),
245+
'headers' => $e->getHeaders()
246+
]);
247+
}
248+
249+
250+
/**
251+
* Example: Whatsapp send a template message to the specified contact
252+
*/
253+
try {
254+
$crmCreateDeal = $apiClient->post('whatsapp/contacts/sendTemplateByPhone', [
255+
"bot_id" => "xxxxxxxxxxxxxxxxxxxxxxxx",
256+
"phone" => "380931112233",
257+
"template" => [
258+
"name" => "thanks_for_buying",
259+
"language" => [
260+
"code" => "en"
261+
],
262+
"components" => []
263+
]
264+
]);
265+
266+
var_dump($crmCreateDeal);
267+
} catch (ApiClientException $e) {
268+
var_dump([
269+
'message' => $e->getMessage(),
270+
'http_code' => $e->getCode(),
271+
'response' => $e->getResponse(),
272+
'curl_errors' => $e->getCurlErrors(),
273+
'headers' => $e->getHeaders()
274+
]);
275+
}
276+
277+
210278
```
211279

0 commit comments

Comments
 (0)