Skip to content

Commit

Permalink
Add new website.reportConversation() method
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriansaliou committed Jan 30, 2025
1 parent 7d92312 commit eafc253
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
11 changes: 11 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,17 @@ CrispClient.website.deliverWidgetDataEditActionForConversation(websiteID, sessio

=========================

https://docs.crisp.chat/references/rest-api/v1/#report-conversation

var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881";

var flag = "spam";

CrispClient.website.reportConversation(websiteID, sessionID, flag);

=========================

https://docs.crisp.chat/references/rest-api/v1/#schedule-a-reminder-for-conversation

var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Crisp API Node wrapper. Authenticate, send messages, fetch conversations, ac

Copyright 2024 Crisp IM SAS. See LICENSE for copying information.

* **📝 Implements**: [REST API Reference (V1)](https://docs.crisp.chat/references/rest-api/v1/) at revision: 27/01/2025
* **📝 Implements**: [REST API Reference (V1)](https://docs.crisp.chat/references/rest-api/v1/) at revision: 30/01/2025
* **😘 Maintainers**: [@baptistejamin](https://github.com/baptistejamin), [@eliottvincent](https://github.com/eliottvincent), [@valeriansaliou](https://github.com/valeriansaliou)

## Installation
Expand Down Expand Up @@ -1012,6 +1012,21 @@ All methods that you will most likely need when building a Crisp integration are
```
</details>

* **Report Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#report-conversation)
* `CrispClient.website.reportConversation(websiteID, sessionID, flag)`
* <details>
<summary>See Example</summary>

```javascript
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881";
var flag = "spam";
CrispClient.website.reportConversation(websiteID, sessionID, flag);
```
</details>


* ### **Website People** _(these are your end-users)_
* **Get People Statistics** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#get-people-statistics)
Expand Down
26 changes: 26 additions & 0 deletions lib/resources/WebsiteConversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,32 @@ function WebsiteConversation(service, crisp) {
}
);
};

/**
* Report Conversation
* @memberof WebsiteConversation
* @public
* @method reportConversation
* @param {string} websiteID
* @param {string} sessionID
* @param {string} flag
* @return {Promise}
*/
service.reportConversation = function(
websiteID, sessionID, flag
) {
return crisp.post(
crisp._prepareRestUrl([
"website", websiteID, "conversation", sessionID, "report"
]),

null,

{
flag : flag
}
);
};
}


Expand Down

0 comments on commit eafc253

Please sign in to comment.