@@ -32,9 +32,9 @@ composer require sendpulse/rest-api
32
32
require 'vendor/autoload.php';
33
33
34
34
// 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");
36
36
// 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");
38
38
// require("your-path/sendpulse-rest-api-php/src/Storage/FileStorage.php");
39
39
// require("your-path/sendpulse-rest-api-php/src/Storage/SessionStorage.php");
40
40
// require("your-path/sendpulse-rest-api-php/src/Storage/MemcachedStorage.php");
@@ -181,6 +181,7 @@ try {
181
181
]);
182
182
}
183
183
184
+
184
185
/*
185
186
* Example: Start Automation360 event
186
187
*/
@@ -207,5 +208,72 @@ try {
207
208
]);
208
209
}
209
210
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
+
210
278
```
211
279
0 commit comments