XendBridge Chat SDK
Installation
$ npm install xendbridgechat-sdk$ yarn add xendbridgechat-sdkUsage
Examples
Last updated
$ npm install xendbridgechat-sdk$ yarn add xendbridgechat-sdkLast updated
# using require
const { getMessageHistory, sendMessage } = require('xendbridgechat-sdk');
# using import
import { getMessageHistory, sendMessage } from 'xendbridgechat-sdk';//implement a better and safer way for getting the following values
const disputeRef = "AdhdfoGjfo8jorp";
const publicKey = "XP_34984hfhsdksofhs";
const getHistory = async () => {
await getMessageHistory(disputeRef, publicKey, getAllChats);
};
//call when connected to application
getHistory();//implement a better and safer way for getting the following values
const disputeRef = "AdhdfoGjfo8jorp";
const publicKey = "XP_34984hfhsdksofhs";
let ChatHubAddCommentModel = {
EmailAddress: "[email protected]",
Comment: comment, //the user's message from the client side
SentBy: 2, //this is always 2 representing the third party user
Recipient: 1, //this is always 1 representing all entities involved
Base64Attachment: "", //this is the image in base64 format
DisputeReference: disputeRef, //the unique dispute reference
SentAt: new Date().toISOString() //this is the time in timestamp
}
//call when user hits the send button on the UI
sendMessage(ChatHubAddCommentModel, publicKey, getAllChats);