1.1.4 • Published 1 year ago

intellicon-interaction-manager v1.1.4

Weekly downloads
172
License
ISC
Repository
-
Last release
1 year ago

Interaction Manager Package for accessing Intellicon Chat internally

Install

npm install intellicon-interaction-manager

then import into your file
const ichat = require('intellicon-interaction-manager');

                        OR
                        
 import ichat from 'intellicon-interaction-manager'  //ES6

connect with Intellicon Interaction Manager using

ichat.init(Auth Token , Base URL of Interaction Manager);

Auth Token is the accessing Token which is provided to access Intellicon Service

Base url is the Intellicon server path

Following events are available to interact with Intellicon chat with their arguments and details

 message={
 interactionId, (required)
  author: {
    id, (required)
    name
 },
 channelMessageId, 
 message,
 messageType,  (required)
 forwarded,
 isChild,
 parentId,
 direction,
 recipient,  (required)
 extension,  (required)
 chennel,    (required)
 attachments: [   // if available
     {
        type,  // e.g. image,video,document etc
        data // object that contains data about attachment like image should have a url
     },
     ....
 ],
 extraPayload:{} //if available
}

ichat.sendMessage(message)

message={
 interactionId, (required)
  author: {
    id, (required)
    name
 },
 message  (required and should be valid JSON string),
 messageType,  (required and should be `template`)
 forwarded,
 isChild,
 parentId,
 direction,  (required should be 1)
 recipient,  (required)
 extension,  (required)
 chennel,    (required)
 extraPayload:{
    preview:  (required)
 } 
}

ichat.sendTemplateMessage(message)

interaction={
   caller:{ 
     id, (required)
     name
   },
   participants: [{
     id,  (required)
     name,  (required)
     role,  (required)
     joinDtTime,  (required)
     leaveDtTime:, (required if participant is leaving)
     status  (required)
   }],
   extension, (required if interaction is inbound)
   status,  (required)
   created: {
    year,   (required if interaction is inbound)
    month,  (required if interaction is inbound)
    day,    (required if interaction is inbound)
    hour,   (required if interaction is inbound) 
    minutes (required if interaction is inbound)
  },
  direction, (required)
  channel, (required)
  campaign: { id , name }
}

ichat.createInteraction(interaction)

    interactionId, // _id of interaction (required)
    extension, // page id/account id/whatsapp number on which interaction arrived (required)
    chennel, // chennal like facebook,whatsapp etc (required)
    
    ichat.generatePublicURL(interactionId,extension,channel)

    interactionId, // _id of interaction (required)
    data, // An object having data to be updated  (required)
    
    ichat.updateInteraction(interactionId,data)

    interactionId, // _id of interaction (required)
    data, // An object having complete object of contact  (required)
    
    ichat.updateInteractionContact(interactionId,data)

    id, // For whom you want history (required)
    args, // An object having any filters like channels etc
    
    ichat.findInteractionHistory(id,args)

    interactionId, // _id of interaction (required)
    agentId, // id of agent who is opening the interaction
    agentName, // Name of agent who is opening the interaction
    
    ichat.reopenInteraction(interactionId,agentId,agentName)

interactionId, // _id of interaction (required)
participants: [
    {
     id, (required)
     name, (required)
     role, (required)
     joinDtTime, (required)
     status (required)
    },
    {
    ...
    }
    ...
],
 
ichat.addParticipants(interactionId, participants)

interactionId, // _id of interaction (required)

ichat.findInteraction(interactionId)

filter, // filter object to be applied for finding interactions (required)
offset, // number of interactions you want to skip (required)

ichat.findInteractions(filter, offset)

     id, // User's id whose open interatcions are going to find  (required)
     args, Object having filter like role etc(required if role is agent) 
     
     ichat.findOpenInteractions(id,args)

     id, // User's id whose open interatcions are going to find  (required)
     args, Object having filter like role etc(required if role is agent) 
     
     ichat.findOpenInteractionsChannelGroup(id,args)

     id, // User's id whose open interatcions are going to find  (required)
     channel, // For what channel interactions is going to find (required)
     args, Object having filter like role etc(required if role is agent) 
     
     ichat.findChannelOpenInteractions(id,channel,args)

     query, // keyword for searching  (required)
     offset, // How many search results you have already loaded or want to skip
     
     ichat.searchInteractions(query,offset)

     query, // keyword for searching  (required)
     offset, // How many search results you have already loaded or want to skip
     
     ichat.searchMessages(query,offset)

     query, // keyword for searching  (required)
     offset, // How many search results you have already loaded or want to skip
     
     ichat.searchComments(query,offset)

     interactionId, // _id of interaction  (required)
     interactionType, // Is it a Chat based interaction or comment based (required)
     
     ichat.viewSearchedInteraction(interactionId,interactionType)

     interactionId, // _id of interaction  (required)
     messageId, // _id of message
     date, // createdAt of message
     
     ichat.viewSearchedMessageInteraction(interactionId,messageId,date)

     interactionId, // _id of interaction  (required)
     commentId, // _id of comment
     date, // createdAt of comment
     
     ichat.viewSearchedCommentInteraction(interactionId,CommentId,date)

      id, // Agent's id whose open interatcions are ignored while finding  (required)
      offset, // number that skips the interactions   (required)
              
      ichat.sharedInbox(id,offset)

      id, // Agent's id whose open interatcions are ignored while finding  (required)
      offset, // number that skips the interactions   (required) 
     
     ichat.sharedInboxChannelGroup(id,offset)

     id, // Agent's id whose open interatcions are ignored while finding  (required)
     channel, // For what channel interactions is going to find (required)
     offset, // number that skips the interactions   (required)  
     
     ichat.channelSharedInbox(id,channel,offset)

interactionId, // _id of interaction (required)
participany:{
   id, (required)
   name, (required)
   role, (required)
   joinDtTime, (required)
   leaveDtTime:, (required if participant is leaving)
   status (required)
}

ichat.updatePartcipant(interactionId, participant)

interactoinId, // _id of interaction   (required)
participantId, //Id of participant who is going to be removed  (required)

ichat.removeParticipant(interactionId, participantId)

interactionId, // _id of interaction (required)
ichat.closeInteraction(interactionId)

interactionId, // _id of interaction (required)
ichat.wrapUpInteraction(interactionId)

interactionId, // _id of Interaction  (required)
workCode:{
    id, (required)
    name, (required)
    description,
    category
}

ichat.addWorkCode(interactionId, workCode)

interatcionId, // _id of Interaction  (required)
 workCodeId, //Id of Work Code which is going to be removed  (required)
 
ichat.removeWorkCode(interactionId, workCodeId)

interactionId, // _id of Interaction   (required)
notes // Text of notes that you wants to update
              
ichat.postNotes(interactionId, notes)

interactionId, // _id of Interaction   (required)
offset, //How to many messages you have already loaded, will be skiped  (required)

ichat.getMessages(interactionId, offset)

interactionId, // _id of Interaction   (required)
date, // previous messages from which date  (required)

ichat.loadPreviousMessages(interactionId, date)

interactionId, // _id of Interaction   (required)
date, // next messages from which date  (required)

ichat.loadNextMessages(interactionId, date)

filter, // An object having attibutes which filters the data that will update  (required)
data:{  (required)
   //properties which you want to update (see message payload of sendMessage event)
}, 

ichat.updateMessage(filter, data)

InteractionId, // _id of Interaction   (required)
participantId, //particpant ID who have read messages   (required)

ichat.markMessagesAsRead(interactionId, participantId)

comment:{
  interactionId, (required)
    channelCommentId
    comment,
    commentType, (required)
    recipient, (required)
    author: {
      id, (required)
      name
    },
    isChild,
    parentId,
    isDeleted,
    attachments: [   // if available
      {
        type,  // e.g. image,video,document etc
        data // url or data string
      },
        ....
    ],
    extraPayload:{} //if available
}

ichat.postComment(comment)

interactionId, // _id of Interaction  (required)
offset, //How to many comments you have already loaded, will be skiped   (required)

ichat.getComments(interactionId, offset)

interactionId, // _id of Interaction   (required)
date, // previous comments from which date  (required)

ichat.loadPreviousComments(interactionId, date)

interactionId, // _id of Interaction   (required)
date, // next comments from which date  (required)

ichat.loadNextComments(interactionId, date)

 filter, // An object having attibutes which filters the data that will update  (required)
    data:{  (required)
       //properties which you want to update (see comment payload of postComment event)
    },
     
 ichat.updateComment(filter, data)

 id, // _id of comment or interaction (required)
 likeType, // post OR comment what you want to like
 like, // like value true or false
     
 ichat.like(id, like,likeType)

 Note: For post like you require to provide id = _id of interaction and likeType = post
       and 
       For comment like you require to provide id = _id of comment and likeType = comment

 commentId, // _id of comment  (required)
 hide, // hide value true or false
     
 ichat.hideComment(commentId, hide)

 commentId, // _id of comment  (required)
     
 ichat.deleteComment(commentId)

     id, // Bot's uuid in case of webChat or page id in case of social media or whatsapp number in case of whatsapp  (required)
     channel // Channel of interaction like webChat, whatsapp etc
     
     ichat.findBot(id,channel)

     event, //  Event that have to be send (required)
     payload // Object containing values to process event
                                       
     ichat.postEvent(event,payload)

     id, //logged in user id (required)
     offset, // How many visitors you have already loaded or want to skip
                                       
     ichat.findVisitors(id,offset)

     interactionId, // _id of interaction (required)
     feedback, // feedback object that should have following keys
     {
        type, //  feedback type will be custom OR default (required)
        author, // id of author (required)
        authorType, // customer or agent (required)
        value, //feedback value like good , bad , emoji, etc (required)
        input, // can be same as value if type is default
        appId,  // id of which feedback app is used (required if type is custom)
      }
                                       
     ichat.postInteractionFeedback(interactionId, feedback)

      data ={
          interactionId, // _id of interaction in which email is going to posted
          text, // email body text
          subject, //email subject,
          html, // complete html of the email
          direction, // for inbound email dircetion would be 0 and for oubtound it is 1
          extension, //email address you use for sending
          from, //Array of objects and each object will consist of name (if have otherwise can be null) and address (email address you use for sending)
          to,   //Array of objects and each object will consist of name (if have otherwise can be null) and address (email addresses you want to send email to)
          receivedAt, // email received date , null in case of outbound email
          attachments: [   // if available
          {
            type,  // e.g. image,video,document etc
            data // Object contains url or data string
          },
            ....
        ],
         status, // send | draft 
         reply, // true   (only use for replying an email)
         messageId, // message id of email whose reply this email is (only use for replying an email)
         forward, // true, if this is a forward email
     }
     
     ichat.postEmail(data)

     interactionId, // _id of interaction for whom interaction emails you want to fetch
     offset, // how many emails you want to skip or already loaded of target interaction
                                       
     ichat.findInteractionEmails(interactionId, offset)

     id, // customer id like email, whatsapp number depends upon channel
     currentInteractionDate, // createdAt date of (current opened) interaction from which you want previous interactions
     channel, // channel of interaction like email, whatsapp, fb_messenger etc
     offset, // how many interactions you want to skip or already loaded
                                       
     ichat.findCustomerPreviousInteractions(id, currentInteractionDate, channel, offset)

     emailId, // _id of email you want to update
     date, // Object that contains values you want to update and values that can be updated can be seen in post email function
                                       
     updateEmail(emailId, data)

     threadId, // thread id find in extra payload of interaction
     offset, // how many emails you want to skip or already loaded of target interaction
                                       
     ichat.findThreadEmails(threadId, offset)

     emailId, // _id of email
                                       
     ichat.deleteEmail(emailId)

     ticketNumber, // unqieue ticket number
     offset, // how many emails you want to skip or already loaded of target interaction
                                       
     ichat.findTicketEmails(ticketNumber, offset)

    data ={
          ticketNumber,   // Unique Number of ticket
          interactionId, // interactionId of email whom reply is this email (only for reply)
          text, // email body text
          subject, //email subject,
          html, // complete html of the email
          direction, // for inbound email dircetion would be 0 and for oubtound it is 1
          extension, //email address you use for sending
          from, //Array of objects and each object will consist of name (if have otherwise can be null) and address (email address you use for sending)
          to,   //Array of objects and each object will consist of name (if have otherwise can be null) and address (email addresses you want to send email to)
          receivedAt, // email received date , null in case of outbound email
          attachments: [   // if available
          {
            type,  // e.g. image,video,document etc
            data // Object contains url or data string
          },
            ....
        ],
         status, // send | draft 
         reply, // true   (only use for replying an email)
         messageId, // message id of email whose reply this email is (only use for replying an email)
         forward, // true, if this is a forward email
        }
     ichat. postTicketEmail(data)

     leadNumber, // unqieue lead number
     offset, // how many emails you want to skip or already loaded of target interaction
                                       
     ichat.findLeadEmails(leadNumber, offset)

    data ={
          ticketNumber,   // Unique Number of lead
          interactionId, // interactionId of email whom reply is this email (only for reply)
          text, // email body text
          subject, //email subject,
          html, // complete html of the email
          direction, // for inbound email dircetion would be 0 and for oubtound it is 1
          extension, //email address you use for sending
          from, //Array of objects and each object will consist of name (if have otherwise can be null) and address (email address you use for sending)
          to,   //Array of objects and each object will consist of name (if have otherwise can be null) and address (email addresses you want to send email to)
          receivedAt, // email received date , null in case of outbound email
          attachments: [   // if available
          {
            type,  // e.g. image,video,document etc
            data // Object contains url or data string
          },
            ....
        ],
         status, // send | draft 
         reply, // true   (only use for replying an email)
         messageId, // message id of email whose reply this email is (only use for replying an email)
         forward, // true, if this is a forward email
        }
     ichat. postLeadEmail(data)

     query, // keyword for searching  (required)
     filter, // An object having extra filters for email searching like threadId, interactionId etc
     offset, // How many search results you have already loaded or want to skip
     
     ichat.searchEmails(query,filter,offset)
1.1.4

1 year ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.72

2 years ago

1.0.71

2 years ago

1.0.70

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.69

2 years ago

1.0.62

2 years ago

1.0.61

2 years ago

1.0.60

2 years ago

1.0.66

2 years ago

1.0.65

2 years ago

1.0.64

2 years ago

1.0.63

2 years ago

1.0.68

2 years ago

1.0.67

2 years ago

1.0.55

2 years ago

1.0.54

2 years ago

1.0.59

2 years ago

1.0.58

2 years ago

1.0.57

2 years ago

1.0.56

2 years ago

1.0.51

3 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.50

3 years ago

1.0.49

3 years ago

1.0.48

3 years ago

1.0.47

3 years ago

1.0.46

3 years ago

1.0.44

3 years ago

1.0.45

3 years ago

1.0.43

3 years ago

1.0.42

3 years ago

1.0.41

3 years ago

1.0.39

3 years ago

1.0.40

3 years ago

1.0.38

3 years ago

1.0.37

3 years ago

1.0.36

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.26

3 years ago

1.0.27

3 years ago

1.0.25

3 years ago

1.0.22

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago