crisp-api
v9.4.0
Published
Crisp API wrapper for Node - official, maintained by Crisp
Downloads
14,532
Readme
Crisp API Wrapper
The Crisp API Node wrapper. Authenticate, send messages, fetch conversations, access your agent accounts from your JavaScript code.
Copyright 2023 Crisp IM SAS. See LICENSE for copying information.
- 📝 Implements: REST API Reference (V1) at revision: 27/08/2024
- 😘 Maintainers: @baptistejamin, @eliottvincent, @valeriansaliou
Installation
npm install --save crisp-api
Authentication
To authenticate against the API, obtain your authentication token keypair by following the REST API Authentication guide. You'll get a token keypair made of 2 values.
Keep your token keypair values private, and store them safely for long-term use.
Then, add authentication parameters to your client
instance right after you create it:
var Crisp = require("crisp-api");
var CrispClient = new Crisp();
// Authenticate to API with your plugin token (identifier, key)
// eg. CrispClient.authenticate("7c3ef21c-1e04-41ce-8c06-5605c346f73e", "cc29e1a5086e428fcc6a697d5837a66d82808e65c5cce006fbf2191ceea80a0a");
CrispClient.authenticateTier("plugin", identifier, key);
// Now, you can use authenticated API sections.
Overview
You may follow the REST API Quickstart guide, which will get you running with the REST API in minutes.
var Crisp = require("crisp-api");
var CrispClient = new Crisp();
CrispClient.authenticateTier("plugin", identifier, key);
CrispClient.website.listConversations(websiteID, 1)
.then(function(conversations) {
console.log("Listed conversations:", conversations);
})
.catch(function(error) {
console.error("Error listing conversations:", error);
});
Examples
Create your own bot!
var Crisp = require("crisp-api");
var CrispClient = new Crisp();
CrispClient.authenticateTier("plugin", identifier, key);
// Notice: make sure to authenticate before listening for an event
CrispClient.on("message:send", function(message) {
CrispClient.website.sendMessageInConversation(
message.website_id, message.session_id,
{
type : "text",
content : "I'm a bot",
from : "operator", // or user
origin : "chat"
}
)
.then(function(message) {
console.log("Message sent:", message);
})
.catch(function(error) {
console.error("Error sending message:", error);
});
})
.then(function() {
console.error("Requested to listen to sent messages");
})
.catch(function(error) {
console.error("Failed listening to sent messages:", error);
});
Resource Methods
All the available Crisp API resources are fully implemented. Programmatic methods names are named after their label name in the REST API Reference.
All methods that you will most likely need when building a Crisp integration are prefixed with a star symbol (⭐).
⚠️ Note that, depending on your authentication token tier, which is either user
or plugin
, you may not be allowed to use all methods from the library. When in doubt, refer to the library method descriptions below. Most likely, you are using a plugin
token.
Website
Website Conversations
⭐ List Conversations [
user
,plugin
]: ReferenceCrispClient.website.listConversations(websiteID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var pageNumber = 1; CrispClient.website.listConversations(websiteID, pageNumber);
List Suggested Conversation Segments [
user
,plugin
]: ReferenceCrispClient.website.listSuggestedConversationSegments(websiteID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var pageNumber = 1; CrispClient.website.listSuggestedConversationSegments(websiteID, pageNumber);
Delete Suggested Conversation Segment [
user
,plugin
]: ReferenceCrispClient.website.deleteSuggestedConversationSegment(websiteID, segment)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var segment = "bug"; CrispClient.website.deleteSuggestedConversationSegment(websiteID, segment);
List Suggested Conversation Data Keys [
user
,plugin
]: ReferenceCrispClient.website.listSuggestedConversationDataKeys(websiteID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var pageNumber = 1; CrispClient.website.listSuggestedConversationDataKeys(websiteID, pageNumber);
Delete Suggested Conversation Data Key [
user
,plugin
]: ReferenceCrispClient.website.deleteSuggestedConversationDataKey(websiteID, key)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var key = "price"; CrispClient.website.deleteSuggestedConversationDataKey(websiteID, key);
List Spam Conversations [
user
]: ReferenceCrispClient.website.listSpamConversations(websiteID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var pageNumber = 1; CrispClient.website.listSpamConversations(websiteID, pageNumber);
Resolve Spam Conversation Content [
user
]: ReferenceCrispClient.website.resolveSpamConversationContent(websiteID, spamID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var spamID = "b45e7d75-61ab-416c-858b-1919b5fcfd10"; CrispClient.website.resolveSpamConversationContent(websiteID, spamID);
Submit Spam Conversation Decision [
user
]: ReferenceCrispClient.website.submitSpamConversationDecision(websiteID, spamID, action)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var spamID = "b45e7d75-61ab-416c-858b-1919b5fcfd10"; var action = "reject"; CrispClient.website.submitSpamConversationDecision(websiteID, spamID, action);
Website Conversation
⭐ Create A New Conversation [
user
,plugin
]: ReferenceCrispClient.website.createNewConversation(websiteID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; CrispClient.website.createNewConversation(websiteID);
Check If Conversation Exists [
user
,plugin
]: ReferenceCrispClient.website.checkConversationExists(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.checkConversationExists(websiteID, sessionID);
⭐ Get A Conversation [
user
,plugin
]: ReferenceCrispClient.website.getConversation(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.getConversation(websiteID, sessionID);
Remove A Conversation [
user
,plugin
]: ReferenceCrispClient.website.removeConversation(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.removeConversation(websiteID, sessionID);
Initiate A Conversation With Existing Session [
user
,plugin
]: ReferenceCrispClient.website.initiateConversationWithExistingSession(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.initiateConversationWithExistingSession(websiteID, sessionID);
⭐ Get Messages In Conversation [
user
,plugin
]: ReferenceCrispClient.website.getMessagesInConversation(websiteID, sessionID, timestampBefore)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var timestampBefore = 1641206011000; CrispClient.website.getMessagesInConversation(websiteID, sessionID, timestampBefore);
⭐ Send A Message In Conversation [
user
,plugin
]: ReferenceCrispClient.website.sendMessageInConversation(websiteID, sessionID, message)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var message = { "type": "text", "from": "operator", "origin": "chat", "content": "Hey there! Need help?" }; CrispClient.website.sendMessageInConversation(websiteID, sessionID, message);
Get A Message In Conversation [
user
,plugin
]: ReferenceCrispClient.website.getMessageInConversation(websiteID, sessionID, fingerprint)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var fingerprint = 524653764345; CrispClient.website.getMessageInConversation(websiteID, sessionID, fingerprint);
Update A Message In Conversation [
user
,plugin
]: ReferenceCrispClient.website.updateMessageInConversation(websiteID, sessionID, fingerprint, content)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var fingerprint = 524653764345; var content = "Hey there! Need help?"; CrispClient.website.updateMessageInConversation(websiteID, sessionID, fingerprint, content);
Remove A Message In Conversation [
user
,plugin
]: ReferenceCrispClient.website.removeMessageInConversation(websiteID, sessionID, fingerprint)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var fingerprint = 524653764345; CrispClient.website.removeMessageInConversation(websiteID, sessionID, fingerprint);
Compose A Message In Conversation [
user
,plugin
]: ReferenceCrispClient.website.composeMessageInConversation(websiteID, sessionID, compose)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var compose = { "type": "start", "from": "operator" }; CrispClient.website.composeMessageInConversation(websiteID, sessionID, compose);
⭐ Mark Messages As Read In Conversation [
user
,plugin
]: ReferenceCrispClient.website.markMessagesReadInConversation(websiteID, sessionID, read)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var read = { "from": "operator", "origin": "urn:crisp.im:slack:0", "fingerprints": [ "5719231201" ] }; CrispClient.website.markMessagesReadInConversation(websiteID, sessionID, read);
⭐ Mark Messages As Delivered In Conversation [
user
,plugin
]: ReferenceCrispClient.website.markMessagesDeliveredInConversation(websiteID, sessionID, delivered)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var delivered = { "from": "operator", "origin": "urn:crisp.im:slack:0", "fingerprints": [ "5719231201" ] }; CrispClient.website.markMessagesDeliveredInConversation(websiteID, sessionID, delivered);
Update Conversation Open State [
user
,plugin
]: ReferenceCrispClient.website.updateConversationOpenState(websiteID, sessionID, opened)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var opened = true; CrispClient.website.updateConversationOpenState(websiteID, sessionID, opened);
⭐ Get Conversation Routing Assign [
user
,plugin
]: ReferenceCrispClient.website.getConversationRoutingAssign(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.getConversationRoutingAssign(websiteID, sessionID);
⭐ Assign Conversation Routing [
user
,plugin
]: ReferenceCrispClient.website.assignConversationRouting(websiteID, sessionID, assign)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var assign = { "assigned": { "user_id": "a4c32c68-be91-4e29-8a05-976e93abbe3f" } }; CrispClient.website.assignConversationRouting(websiteID, sessionID, assign);
Update Conversation Inbox [
user
,plugin
]: ReferenceCrispClient.website.updateConversationInbox(websiteID, sessionID, inboxID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var inboxID = "bf6935c9-43b3-4f8e-87ea-175c1e1ed1a9"; CrispClient.website.updateConversationInbox(websiteID, sessionID, inboxID);
⭐ Get Conversation Metas [
user
,plugin
]: ReferenceCrispClient.website.getConversationMetas(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.getConversationMetas(websiteID, sessionID);
⭐ Update Conversation Metas [
user
,plugin
]: ReferenceCrispClient.website.updateConversationMetas(websiteID, sessionID, metas)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var metas = { "nickname": "John Doe", "email": "[email protected]", "segments": [ "happy", "customer", "love" ], "data": { "type": "customer", "signup": "finished" } }; CrispClient.website.updateConversationMetas(websiteID, sessionID, metas);
Get An Original Message In Conversation [
user
,plugin
]: ReferenceCrispClient.website.getOriginalMessageInConversation(websiteID, sessionID, originalID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var originalID = "2325a3c0-9b47-4fc6-b00e-111b752e44cd"; CrispClient.website.getOriginalMessageInConversation(websiteID, sessionID, originalID);
List Conversation Pages [
user
,plugin
]: ReferenceCrispClient.website.listConversationPages(websiteID, sessionID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var pageNumber = 1; CrispClient.website.listConversationPages(websiteID, sessionID, pageNumber);
List Conversation Events [
user
,plugin
]: ReferenceCrispClient.website.listConversationEvents(websiteID, sessionID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var pageNumber = 1; CrispClient.website.listConversationEvents(websiteID, sessionID, pageNumber);
List Conversation Files [
user
,plugin
]: ReferenceCrispClient.website.listConversationFiles(websiteID, sessionID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var pageNumber = 1; CrispClient.website.listConversationFiles(websiteID, sessionID, pageNumber);
Get Conversation State [
user
,plugin
]: ReferenceCrispClient.website.getConversationState(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.getConversationState(websiteID, sessionID);
⭐ Change Conversation State [
user
,plugin
]: ReferenceCrispClient.website.changeConversationState(websiteID, sessionID, state)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var state = "unresolved"; CrispClient.website.changeConversationState(websiteID, sessionID, state);
Get Conversation Participants [
user
,plugin
]: ReferenceCrispClient.website.getConversationParticipants(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.getConversationParticipants(websiteID, sessionID);
Save Conversation Participants [
user
,plugin
]: ReferenceCrispClient.website.saveConversationParticipants(websiteID, sessionID, participants)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var participants = { "participants": [ { "type": "email", "target": "[email protected]" } ] }; CrispClient.website.saveConversationParticipants(websiteID, sessionID, participants);
Get Block Status For Conversation [
user
,plugin
]: ReferenceCrispClient.website.getBlockStatusForConversation(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.getBlockStatusForConversation(websiteID, sessionID);
Block Incoming Messages For Conversation [
user
,plugin
]: ReferenceCrispClient.website.blockIncomingMessagesForConversation(websiteID, sessionID, blocked)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var blocked = true; CrispClient.website.blockIncomingMessagesForConversation(websiteID, sessionID, blocked);
Get Verify Status For Conversation [
user
,plugin
]: ReferenceCrispClient.website.getVerifyStatusForConversation(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.getVerifyStatusForConversation(websiteID, sessionID);
Update Verify Status For Conversation [
user
,plugin
]: ReferenceCrispClient.website.updateVerifyStatusForConversation(websiteID, sessionID, verified)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var verified = true; CrispClient.website.updateVerifyStatusForConversation(websiteID, sessionID, verified);
Request Email Transcript For Conversation [
user
,plugin
]: ReferenceCrispClient.website.requestEmailTranscriptForConversation(websiteID, sessionID, to, email)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var email = { "to": "operator", "email": "[email protected]" }; CrispClient.website.requestEmailTranscriptForConversation(websiteID, sessionID, to, email);
Request Chatbox Binding Purge For Conversation [
user
,plugin
]: ReferenceCrispClient.website.requestChatboxBindingPurgeForConversation(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.requestChatboxBindingPurgeForConversation(websiteID, sessionID);
Request User Feedback For Conversation [
user
,plugin
]: ReferenceCrispClient.website.requestUserFeedbackForConversation(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.requestUserFeedbackForConversation(websiteID, sessionID);
List Browsing Sessions For Conversation [
user
,plugin
]: ReferenceCrispClient.website.listBrowsingSessionsForConversation(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.listBrowsingSessionsForConversation(websiteID, sessionID);
Initiate Browsing Session For Conversation [
user
,plugin
]: ReferenceCrispClient.website.initiateBrowsingSessionForConversation(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.initiateBrowsingSessionForConversation(websiteID, sessionID);
Send Action To An Existing Browsing Session [
user
,plugin
]: ReferenceCrispClient.website.sendActionToExistingBrowsingSession(websiteID, sessionID, browsingID, action)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var browsingID = "browsing_05a9392d-ff3f-45e7-b021-1179c45668fa"; var action = "start"; CrispClient.website.sendActionToExistingBrowsingSession(websiteID, sessionID, browsingID, action);
Assist Existing Browsing Session [
user
,plugin
]: ReferenceCrispClient.website.assistExistingBrowsingSession(websiteID, sessionID, browsingID, assist)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var browsingID = "browsing_05a9392d-ff3f-45e7-b021-1179c45668fa"; var assist = { "action": "mouse", "mouse": { "x": 0, "y": 784 } }; CrispClient.website.assistExistingBrowsingSession(websiteID, sessionID, browsingID, assist);
Initiate New Call Session For Conversation [
user
,plugin
]: ReferenceCrispClient.website.initiateNewCallSessionForConversation(websiteID, sessionID, mode)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var mode = "audio"; CrispClient.website.initiateNewCallSessionForConversation(websiteID, sessionID, mode);
Get Ongoing Call Session For Conversation [
user
,plugin
]: ReferenceCrispClient.website.getOngoingCallSessionForConversation(websiteID, sessionID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; CrispClient.website.getOngoingCallSessionForConversation(websiteID, sessionID);
Abort Ongoing Call Session For Conversation [
user
,plugin
]: ReferenceCrispClient.website.abortOngoingCallSessionForConversation(websiteID, sessionID, callID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var callID = "call_35a0c062-72fa-4095-a2a0-f9911d47ee56"; CrispClient.website.abortOngoingCallSessionForConversation(websiteID, sessionID, callID);
Transmit Signaling On Ongoing Call Session [
user
,plugin
]: ReferenceCrispClient.website.transmitSignalingOnOngoingCallSession(websiteID, sessionID, callID, payload)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var callID = "call_35a0c062-72fa-4095-a2a0-f9911d47ee56"; var payload = { "type": "sdp", "payload": {} }; CrispClient.website.transmitSignalingOnOngoingCallSession(websiteID, sessionID, callID, payload);
Deliver Widget Button Action For Conversation [
user
]: ReferenceCrispClient.website.deliverWidgetButtonActionForConversation(websiteID, sessionID, pluginID, sectionID, itemID, data, value)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var pluginID = "c64f3595-adee-425a-8d3a-89d47f7ed6bb"; var sectionID = "8f8d3041-6698-43b8-a559-ae93211e6292"; var itemID = "7631d7d8-4fe7-4ef8-9a36-31183dcd4785"; var value = { "section_id": "payments", "item_id": "refund_on_stripe", "data": { "invoice": "D-1929-X" } }; CrispClient.website.deliverWidgetButtonActionForConversation(websiteID, sessionID, pluginID, sectionID, itemID, data, value);
Deliver Widget Data Fetch Action For Conversation [
user
]: ReferenceCrispClient.website.deliverWidgetDataFetchActionForConversation(websiteID, sessionID, pluginID, sectionID, itemID, data)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var pluginID = "c64f3595-adee-425a-8d3a-89d47f7ed6bb"; var sectionID = "8f8d3041-6698-43b8-a559-ae93211e6292"; var itemID = "7631d7d8-4fe7-4ef8-9a36-31183dcd4785"; var data = { "section_id": "payments", "item_id": "unpaid_balance", "action": "fetch", "data": {} }; CrispClient.website.deliverWidgetDataFetchActionForConversation(websiteID, sessionID, pluginID, sectionID, itemID, data);
Deliver Widget Data Edit Action For Conversation [
user
]: ReferenceCrispClient.website.deliverWidgetDataEditActionForConversation(websiteID, sessionID, pluginID, sectionID, itemID, value)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var pluginID = "c64f3595-adee-425a-8d3a-89d47f7ed6bb"; var sectionID = "8f8d3041-6698-43b8-a559-ae93211e6292"; var itemID = "7631d7d8-4fe7-4ef8-9a36-31183dcd4785"; var data = { "section_id": "payments", "item_id": "unpaid_balance", "action": "fetch", "data": {} }; CrispClient.website.deliverWidgetDataFetchActionForConversation(websiteID, sessionID, pluginID, sectionID, itemID, data);
Schedule A Reminder For Conversation [
user
,plugin
]: ReferenceCrispClient.website.scheduleReminderForConversation(websiteID, sessionID, date, note)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"; var note = { "date": "2018-05-29T09:00:00Z", "note": "Call this customer." }; CrispClient.website.scheduleReminderForConversation(websiteID, sessionID, date, note);
Website People (these are your end-users)
Get People Statistics [
user
,plugin
]: ReferenceCrispClient.website.getPeopleStatistics(websiteID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; CrispClient.website.getPeopleStatistics(websiteID);
List Suggested People Segments [
user
,plugin
]: ReferenceCrispClient.website.listSuggestedPeopleSegments(websiteID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var pageNumber = 1; CrispClient.website.listSuggestedPeopleSegments(websiteID, pageNumber);
Delete Suggested People Segment [
user
,plugin
]: ReferenceCrispClient.website.deleteSuggestedPeopleSegment(websiteID, segment)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var segment = "poweruser"; CrispClient.website.deleteSuggestedPeopleSegment(websiteID, segment);
List Suggested People Data Keys [
user
,plugin
]: ReferenceCrispClient.website.listSuggestedPeopleDataKeys(websiteID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var pageNumber = 1; CrispClient.website.listSuggestedPeopleDataKeys(websiteID, pageNumber);
Delete Suggested People Data Key [
user
,plugin
]: ReferenceCrispClient.website.deleteSuggestedPeopleDataKey(websiteID, key)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var key = "price"; CrispClient.website.deleteSuggestedPeopleDataKey(websiteID, key);
List Suggested People Events [
user
,plugin
]: ReferenceCrispClient.website.listSuggestedPeopleEvents(websiteID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var pageNumber = 1; CrispClient.website.listSuggestedPeopleEvents(websiteID, pageNumber);
Delete Suggested People Event [
user
,plugin
]: ReferenceCrispClient.website.deleteSuggestedPeopleEvent(websiteID, text)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var text = "Removed item from basket"; CrispClient.website.deleteSuggestedPeopleEvent(websiteID, text);
⭐ List People Profiles [
user
,plugin
]: ReferenceCrispClient.website.listPeopleProfiles(websiteID, pageNumber, searchField, searchOrder, searchOperator, searchFilter, searchText)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var pageNumber = 1; CrispClient.website.listPeopleProfiles(websiteID, pageNumber, searchField, searchOrder, searchOperator, searchFilter, searchText);
⭐ Add New People Profile [
user
,plugin
]: ReferenceCrispClient.website.addNewPeopleProfile(websiteID, peopleProfile)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleProfile = { "email": "[email protected]", "person": { "nickname": "Valerian Saliou" } }; CrispClient.website.addNewPeopleProfile(websiteID, peopleProfile);
⭐ Check If People Profile Exists [
user
,plugin
]: ReferenceCrispClient.website.checkPeopleProfileExists(websiteID, peopleID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; CrispClient.website.checkPeopleProfileExists(websiteID, peopleID);
⭐ Get People Profile [
user
,plugin
]: ReferenceCrispClient.website.getPeopleProfile(websiteID, peopleID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; CrispClient.website.getPeopleProfile(websiteID, peopleID);
⭐ Save People Profile [
user
,plugin
]: ReferenceCrispClient.website.savePeopleProfile(websiteID, peopleID, peopleProfile)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; var peopleProfile = { "email": "[email protected]", "person": { "nickname": "Valerian Saliou" } }; CrispClient.website.savePeopleProfile(websiteID, peopleID, peopleProfile);
⭐ Update People Profile [
user
,plugin
]: ReferenceCrispClient.website.updatePeopleProfile(websiteID, peopleID, peopleProfile)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; var peopleProfile = { "email": "[email protected]", "person": { "nickname": "Valerian Saliou" } }; CrispClient.website.updatePeopleProfile(websiteID, peopleID, peopleProfile);
⭐ Remove People Profile [
user
,plugin
]: ReferenceCrispClient.website.removePeopleProfile(websiteID, peopleID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; CrispClient.website.removePeopleProfile(websiteID, peopleID);
List People Conversations [
user
,plugin
]: ReferenceCrispClient.website.listPeopleConversations(websiteID, peopleID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; var pageNumber = 1; CrispClient.website.listPeopleConversations(websiteID, peopleID, pageNumber);
List People Campaigns [
user
]: ReferenceCrispClient.website.listPeopleCampaigns(websiteID, peopleID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; var pageNumber = 1; CrispClient.website.listPeopleCampaigns(websiteID, peopleID, pageNumber);
Add A People Event [
user
,plugin
]: ReferenceCrispClient.website.addPeopleEvent(websiteID, peopleID, peopleEvent)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; var peopleEvent = { "text": "Added item to basket", "data": { "price": 10.99, "currency": "USD" }, "color": "red" }; CrispClient.website.addPeopleEvent(websiteID, peopleID, peopleEvent);
List People Events [
user
,plugin
]: ReferenceCrispClient.website.listPeopleEvents(websiteID, peopleID, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; var pageNumber = 1; CrispClient.website.listPeopleEvents(websiteID, peopleID, pageNumber);
Get People Data [
user
,plugin
]: ReferenceCrispClient.website.getPeopleData(websiteID, peopleID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; CrispClient.website.getPeopleData(websiteID, peopleID);
Save People Data [
user
,plugin
]: ReferenceCrispClient.website.savePeopleData(websiteID, peopleID, peopleData)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; var peopleData = { "data": { "type": "customer", "signup": "finished" } }; CrispClient.website.savePeopleData(websiteID, peopleID, peopleData);
Update People Data [
user
,plugin
]: ReferenceCrispClient.website.updatePeopleData(websiteID, peopleID, peopleData)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; var peopleData = { "data": { "signup": "finished" } }; CrispClient.website.updatePeopleData(websiteID, peopleID, peopleData);
Get People Subscription Status [
user
,plugin
]: ReferenceCrispClient.website.getPeopleSubscriptionStatus(websiteID, peopleID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; CrispClient.website.getPeopleSubscriptionStatus(websiteID, peopleID);
Update People Subscription Status [
user
,plugin
]: ReferenceCrispClient.website.updatePeopleSubscriptionStatus(websiteID, peopleID, peopleSubscription)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var peopleID = "c5a2f70c-f605-4648-b47f-8c39d4b03a50"; var peopleSubscription = { "email": true }; CrispClient.website.updatePeopleSubscriptionStatus(websiteID, peopleID, peopleSubscription);
Export People Profiles [
user
]: ReferenceCrispClient.website.exportPeopleProfiles(websiteID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; CrispClient.website.exportPeopleProfiles(websiteID);
Import People Profiles [
user
]: ReferenceCrispClient.website.importPeopleProfiles(websiteID, profileImportSetup)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var profileImportSetup = { "url": "https://storage.crisp.chat/users/processing/import/aa0b64dd-9fb4-4db9-80d6-5a49eb84087b/19d956c7-0294-45ad-89e1-58ce45e7008f.csv", "mapping": [ { "column": 1, "field": "email" }, { "column": 2, "field": "person.nickname" } ], "options": { "column_separator": ";", "skip_header": true } }; CrispClient.website.importPeopleProfiles(websiteID, profileImportSetup);
👉 Notice: The peopleID
argument can be an email or the peopleID
.
Website Helpdesk
Check If Helpdesk Exists [
user
,plugin
]: ReferenceCrispClient.website.checkHelpdeskExists(websiteID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; CrispClient.website.checkHelpdeskExists(websiteID);
Resolve Helpdesk [
user
,plugin
]: ReferenceCrispClient.website.resolveHelpdesk(websiteID)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; CrispClient.website.resolveHelpdesk(websiteID);
Initialize Helpdesk [
user
]: ReferenceCrispClient.website.initializeHelpdesk(websiteID, name, domainBasic)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var name = "Valerian Helpdesk"; var domainBasic = "valerian"; CrispClient.website.initializeHelpdesk(websiteID, name, domainBasic);
Delete Helpdesk [
user
]: ReferenceCrispClient.website.deleteHelpdesk(websiteID, verify)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var verify = { "method": "password", "secret": "MySuperSecurePassword"; }; CrispClient.website.deleteHelpdesk(websiteID, verify);
List Helpdesk Locales [
user
,plugin
]: ReferenceCrispClient.website.listHelpdeskLocales(websiteID, pageNumber, options={})
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var pageNumber = 1; CrispClient.website.listHelpdeskLocales(websiteID, pageNumber, { order_visits : "1" });
Add Helpdesk Locale [
user
,plugin
]: ReferenceCrispClient.website.addHelpdeskLocale(websiteID, locale)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; CrispClient.website.addHelpdeskLocale(websiteID, locale);
Check If Helpdesk Locale Exists [
user
,plugin
]: ReferenceCrispClient.website.checkHelpdeskLocaleExists(websiteID, locale)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; CrispClient.website.checkHelpdeskLocaleExists(websiteID, locale);
Resolve Helpdesk Locale [
user
,plugin
]: ReferenceCrispClient.website.resolveHelpdeskLocale(websiteID, locale)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; CrispClient.website.resolveHelpdeskLocale(websiteID, locale);
Delete Helpdesk Locale [
user
,plugin
]: ReferenceCrispClient.website.deleteHelpdeskLocale(websiteID, locale)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; CrispClient.website.deleteHelpdeskLocale(websiteID, locale);
List Helpdesk Locale Articles [
user
,plugin
]: ReferenceCrispClient.website.listHelpdeskLocaleArticles(websiteID, locale, pageNumber)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var pageNumber = 1; CrispClient.website.listHelpdeskLocaleArticles(websiteID, locale, pageNumber);
Add A New Helpdesk Locale Article [
user
,plugin
]: ReferenceCrispClient.website.addNewHelpdeskLocaleArticle(websiteID, locale, title)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var title = "How to use $crisp JavaScript SDK?"; CrispClient.website.addNewHelpdeskLocaleArticle(websiteID, locale, title);
Check If Helpdesk Locale Article Exists [
user
,plugin
]: ReferenceCrispClient.website.checkHelpdeskLocaleArticleExists(websiteID, locale, articleId)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var articleId = "fd036d68-c619-4c63-9deb-e2ce91733dd6"; CrispClient.website.checkHelpdeskLocaleArticleExists(websiteID, locale, articleId);
Resolve Helpdesk Locale Article [
user
,plugin
]: ReferenceCrispClient.website.resolveHelpdeskLocaleArticle(websiteID, locale, articleId)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var articleId = "fd036d68-c619-4c63-9deb-e2ce91733dd6"; CrispClient.website.resolveHelpdeskLocaleArticle(websiteID, locale, articleId);
Save Helpdesk Locale Article [
user
,plugin
]: ReferenceCrispClient.website.saveHelpdeskLocaleArticle(websiteID, locale, articleId, article)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var articleId = "fd036d68-c619-4c63-9deb-e2ce91733dd6"; var article = { "title": "How to use $crisp JavaScript SDK?", "description": null, "content": "Crisp lets you create your customized chatbox easily. **It's easy to setup**.", "featured": false, "order": 1 }; CrispClient.website.saveHelpdeskLocaleArticle(websiteID, locale, articleId, article);
Update Helpdesk Locale Article [
user
,plugin
]: ReferenceCrispClient.website.updateHelpdeskLocaleArticle(websiteID, locale, articleId, article)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var articleId = "fd036d68-c619-4c63-9deb-e2ce91733dd6"; var article = { "content": "Crisp lets you create your customized chatbox easily. **It's easy to setup**." }; CrispClient.website.updateHelpdeskLocaleArticle(websiteID, locale, articleId, article);
Delete Helpdesk Locale Article [
user
,plugin
]: ReferenceCrispClient.website.deleteHelpdeskLocaleArticle(websiteID, locale, articleId)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var articleId = "fd036d68-c619-4c63-9deb-e2ce91733dd6"; CrispClient.website.deleteHelpdeskLocaleArticle(websiteID, locale, articleId);
Resolve Helpdesk Locale Article Page [
user
,plugin
]: ReferenceCrispClient.website.resolveHelpdeskLocaleArticlePage(websiteID, locale, articleId)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var articleId = "fd036d68-c619-4c63-9deb-e2ce91733dd6"; CrispClient.website.resolveHelpdeskLocaleArticlePage(websiteID, locale, articleId);
Resolve Helpdesk Locale Article Category [
user
,plugin
]: ReferenceCrispClient.website.resolveHelpdeskLocaleArticleCategory(websiteID, locale, articleId)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var articleId = "fd036d68-c619-4c63-9deb-e2ce91733dd6"; CrispClient.website.resolveHelpdeskLocaleArticleCategory(websiteID, locale, articleId);
Update Helpdesk Locale Article Category [
user
,plugin
]: ReferenceCrispClient.website.updateHelpdeskLocaleArticleCategory(websiteID, locale, articleId, categoryId, sectionId)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var articleId = "fd036d68-c619-4c63-9deb-e2ce91733dd6"; var categoryId = "00d344a3-8948-45b5-9bc4-82ec249fcd44"; CrispClient.website.updateHelpdeskLocaleArticleCategory(websiteID, locale, articleId, categoryId);
List Helpdesk Locale Article Alternates [
user
,plugin
]: ReferenceCrispClient.website.listHelpdeskLocaleArticleAlternates(websiteID, locale, articleId)
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc"; var locale = "en"; var articleId = "fd036d68-c619-4c63-9deb-e2ce91733dd6"; CrispClient.website.listHelpdeskLocaleArticleAlternates(websiteID, locale, articleId);
Check If Helpdesk Locale Article Alternate Exists [
user
,plugin
]: [Reference](https://docs.crisp.cha