@freshworks-jaya/freshchat-api
TypeScript icon, indicating that this package has built-in type declarations

0.7.35 • Public • Published

SDK for Freshchat API

Install

npm install --save @freshworks-jaya/freshchat-api

or

yarn add @freshworks-jaya/freshchat-api

Usage

import Freshchat from '@freshworks-jaya/freshchat-api';

const freshchat = new Freshchat('https://api.freshchat.com/v2', '<freshchat-api-token>');

On Marketplace App server.js

const Freshchat = require('@freshworks-jaya/freshchat-api').default;

var freshchat = new Freshchat('https://api.freshchat.com/v2', '<freshchat-api-token>');

Examples

Resolve a conversation

freshchat.conversationStatusUpdate('<conversation-id>', 'resolved');

Reopen a conversation

freshchat.conversationStatusUpdate('<conversation-id>', 'new');

Generate chat Transcript

var appUrl = 'https://domain.freshchat.com';
var appAlias = '<App ID>'; //Available from Settings--> Mobile SDKs
var conversationId = '<Freshchat Conversation UUID>';

freshchat.getConversationTranscript(
  appUrl, 
  appAlias, 
  conversationId, 
  {
    //The below value can either be 'text' or 'html'
    output: 'html', 
    //Below is a Flag to include the conversation link in the generated transcript.
    isIncludeFreshchatLink: true, 
    //Below is a Flag to generate transcript for the entire conversation or every interaction. (Create -> Latest message, Reopen -> Latest message)
    isFetchUntilLastResolve: true,
    //Choose a timezone offset for timestamps in conversation
    timezoneOffset: 330 // for Asia/Kolkata timezone
    //Limit the number of messages fetched in the transcript
    messagesLimit: 200
  }, 
  {
    //Exclude normal messages
    isExcludeNormal: false,
    //Exclude private messages
    isExcludePrivate: false,
    //Exclude system messages
    isExcludeSystem: true
  })
  .then(function (resp) {
    console.log(resp);
  }, function (error) {
    console.log(error);
  });

Reports API

const Freshchat = require('@freshworks-jaya/freshchat-api').default;
var freshchat = new Freshchat('https://api.freshchat.com/v2', '<freshchat-api-token>');

var startTime = '2020-12-03T05:08:36.791Z';
var endTime = '2020-12-04T05:08:35.791Z';
var eventType = 'classic';
var isExcludePii = false;

Trigger a Raw Report

freshchat.triggerRawReports(startTime, endTime, eventType, isExcludePii)
  .then(function (response) {
    { id } = response;
    console.log('Request ID: ', id);
  }, function (error) {
    console.log(error);
  });

Retrieve a Raw Report

Use the Request ID from the response of the Trigger Raw Report API to retrieve the report.

freshchat.retrieveRawReports(requestId)
  .then(function (response) {  
    console.log(response);
  }, function (error) {
    console.log(error);
  });

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.7.3526latest
0.7.36-beta-31beta

Version History

VersionDownloads (Last 7 Days)Published
0.7.36-beta-31
0.7.36-beta-210
0.7.36-beta-11
0.7.361
0.7.35-beta-051
0.7.35-beta-041
0.7.35-beta-031
0.7.35-beta-021
0.7.35-beta-011
0.7.36-beta-011
0.7.3526
0.7.341
0.7.33-beta-111
0.7.34-hack-011
0.7.33-beta-101
0.7.33-beta-091
0.7.33-beta-081
0.7.33-beta-071
0.7.33-beta-061
0.7.33-beta-051
0.7.33-beta-041
0.7.33-beta-031
0.7.33-beta-1.01
0.7.33-beta-021
0.7.33-beta-011
0.7.34-beta-11
0.7.331
0.7.33-beta-31
0.7.33-beta-21
0.7.33-beta-11
0.7.322
0.7.32-beta21
0.7.32-beta11
0.7.311
0.7.31-beta.31
0.7.31-beta.131
0.7.31-beta.121
0.7.31-beta.111
0.7.31-beta.101
0.7.31-beta.21
0.7.31-beta.11
0.7.31-beta.01
0.7.301
0.7.30-beta.21
0.7.30-beta.11
0.7.30-beta1
0.7.291
0.7.281
0.7.28-alpha.11
0.7.271
0.7.261
0.7.251
0.7.241
0.7.231
0.7.23-alpha.11
0.7.23-alpha.01
0.7.221
0.7.211
0.7.21-alpha.01
0.7.201
0.7.20-alpha.01
0.7.191
0.7.19-alpha.11
0.7.19-alpha.01
0.7.181
0.7.171
0.7.16-alpha.11
0.7.16-alpha.01
0.7.151
0.7.141
0.7.131
0.7.13-alpha.01
0.7.121
0.7.111
0.7.101
0.7.10-alpha.41
0.7.10-y.01
0.7.10-alpha.21
0.7.10-alpha.11
0.7.10-alpha.01
0.7.91
0.7.81
0.7.71
0.7.61
0.7.51
0.7.41
0.7.31
0.7.3-alpha.01
0.7.21
0.7.11
0.7.01
0.7.0-alpha.61
0.7.0-alpha.51
0.7.0-alpha.41
0.7.0-alpha.31
0.7.0-alpha.21
0.7.0-alpha.11
0.7.0-alpha.01
0.6.01
0.5.01
0.4.01
0.4.0-alpha.01
0.3.11
0.3.01
0.2.01
0.2.0-alpha.01
0.1.01
0.0.26-alpha.01
0.0.251
0.0.241
0.0.221
0.0.211
0.0.201
0.0.191
0.0.181
0.0.171
0.0.161
0.0.151
0.0.15-alpha.01
0.0.141
0.0.131
0.0.121
0.0.111
0.0.101

Package Sidebar

Install

npm i @freshworks-jaya/freshchat-api

Weekly Downloads

150

Version

0.7.35

License

ISC

Unpacked Size

55.4 kB

Total Files

29

Last publish

Collaborators

  • abiswasfreshworks
  • prabhu_kathiresan
  • srivatsan07
  • abisht1991
  • vinu_1936
  • gopig
  • bhavani.freshworks
  • shashaankkrishnatray
  • bharatram-santhanakrishnan