Skip to content

Commit 5cfac83

Browse files
committed
New batch routes
1 parent 80f415d commit 5cfac83

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,52 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
10021002
```
10031003
</details>
10041004

1005+
* **Batch Data Items** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#batch-data-items)
1006+
* `CrispClient->websiteBatch->batchDataItems(websiteId, data)`
1007+
* <details>
1008+
<summary>See Example</summary>
1009+
1010+
```php
1011+
$websiteId = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
1012+
1013+
$data = [
1014+
"sessions" => [
1015+
"session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
1016+
"session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
1017+
],
1018+
"data" => [
1019+
"plan" => "pro",
1020+
"subscribed" => true
1021+
]
1022+
];
1023+
1024+
CrispClient->websiteBatch->batchDataItems($websiteId, $data);
1025+
```
1026+
</details>
1027+
1028+
* **Batch Segments Items** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#batch-segments-items)
1029+
* `CrispClient->websiteBatch->batchSegmentsItems(websiteId, data)`
1030+
* <details>
1031+
<summary>See Example</summary>
1032+
1033+
```php
1034+
$websiteId = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
1035+
1036+
$data = [
1037+
"sessions" => [
1038+
"session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
1039+
"session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
1040+
],
1041+
"segments" => [
1042+
"vip",
1043+
"lead"
1044+
]
1045+
];
1046+
1047+
CrispClient->websiteBatch->batchSegmentsItems($websiteId, $data);
1048+
```
1049+
</details>
1050+
10051051

10061052

10071053
### Plugins

src/Resources/WebsiteBatch.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,30 @@ public function batchInboxItems($websiteId, $data)
129129
$result = $this->crisp->patch("website/$websiteId/batch/inbox", json_encode($data));
130130
return $this->formatResponse($result);
131131
}
132+
133+
/**
134+
* @param string $websiteId
135+
* @param array $data
136+
* @return array
137+
* @throws CrispException
138+
* @throws ClientExceptionInterface
139+
*/
140+
public function batchDataItems($websiteId, $data)
141+
{
142+
$result = $this->crisp->patch("website/$websiteId/batch/data", json_encode($data));
143+
return $this->formatResponse($result);
144+
}
145+
146+
/**
147+
* @param string $websiteId
148+
* @param array $data
149+
* @return array
150+
* @throws CrispException
151+
* @throws ClientExceptionInterface
152+
*/
153+
public function batchSegmentsItems($websiteId, $data)
154+
{
155+
$result = $this->crisp->patch("website/$websiteId/batch/segments", json_encode($data));
156+
return $this->formatResponse($result);
157+
}
132158
}

0 commit comments

Comments
 (0)