Skip to content

Commit

Permalink
Merge pull request #82 from sendpulse/change_readme
Browse files Browse the repository at this point in the history
Change readme
  • Loading branch information
bilovol authored Oct 25, 2023
2 parents e1a81e2 + 36771e3 commit 7a00998
Showing 1 changed file with 70 additions and 2 deletions.
72 changes: 70 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ composer require sendpulse/rest-api
require 'vendor/autoload.php';

// Without Composer (and instead of "require 'vendor/autoload.php'"):
// require("your-path/sendpulse-rest-api-php/src/ApiInterface.php");
// require("your-path/sendpulse-rest-api-php/src/Contracts/ApiInterface.php");
// require("your-path/sendpulse-rest-api-php/src/ApiClient.php");
// require("your-path/sendpulse-rest-api-php/src/Storage/TokenStorageInterface.php");
// require("your-path/sendpulse-rest-api-php/src/Contracts/TokenStorageInterface.php");
// require("your-path/sendpulse-rest-api-php/src/Storage/FileStorage.php");
// require("your-path/sendpulse-rest-api-php/src/Storage/SessionStorage.php");
// require("your-path/sendpulse-rest-api-php/src/Storage/MemcachedStorage.php");
Expand Down Expand Up @@ -181,6 +181,7 @@ try {
]);
}


/*
* Example: Start Automation360 event
*/
Expand All @@ -207,5 +208,72 @@ try {
]);
}


/**
* Example: Crm create a new deal
*/
try {
$crmCreateDeal = $apiClient->post('crm/v1/deals', [
"pipelineId" => 0,
"stepId" => 0,
"responsibleId" => 0,
"name" => "string",
"price" => 0,
"currency" => "string",
"sourceId" => 0,
"contact" => [
0
],
"attributes" => [
[
"attributeId" => 0,
"value" => "string"
]
],
"attachments" => [
"https://link-to-file.com/file.jpg"
]
]);

var_dump($crmCreateDeal);
} catch (ApiClientException $e) {
var_dump([
'message' => $e->getMessage(),
'http_code' => $e->getCode(),
'response' => $e->getResponse(),
'curl_errors' => $e->getCurlErrors(),
'headers' => $e->getHeaders()
]);
}


/**
* Example: Whatsapp send a template message to the specified contact
*/
try {
$crmCreateDeal = $apiClient->post('whatsapp/contacts/sendTemplateByPhone', [
"bot_id" => "xxxxxxxxxxxxxxxxxxxxxxxx",
"phone" => "380931112233",
"template" => [
"name" => "thanks_for_buying",
"language" => [
"code" => "en"
],
"components" => []
]
]);

var_dump($crmCreateDeal);
} catch (ApiClientException $e) {
var_dump([
'message' => $e->getMessage(),
'http_code' => $e->getCode(),
'response' => $e->getResponse(),
'curl_errors' => $e->getCurlErrors(),
'headers' => $e->getHeaders()
]);
}


```

0 comments on commit 7a00998

Please sign in to comment.