Stella Platform Documentation

Stella Platform Documentation

  • Docs
  • API
  • FAQ
  • Languages iconEnglish
    • 中文

›Context Reference

Get Started

  • Introduction

Context Reference

  • Message Event
  • Member
  • Channel
  • Integrations
  • Agenda Meta
  • Group
  • Methods

REST API

  • Introduction and Prerequisite
  • Errors
  • Meta Object
  • API Methods

Methods

These are the methods that can be accessed by the word this. You can make use of the these method to perform different kinds of features like setting new agenda, sending emails, etc.

Example

const obj = { 'a': [{ 'b': { 'c': 3 } }] };

this.lodash.get(obj, 'a[0].b.c', null);
// => 3

3rd party library methods

PropertyTypeDescription
fetchfunctionPlease see the node-fetch documentation for further reference.
momentfunctionPlease see the moment documentation for further reference.
lodashfunctionPlease see the lodash documentation for further reference.

Custom methods provided by Stella

addNewTargetsToAssignment

The method addNewTargetsToAssignment() is used to add new broadcast groups to assignment for different channels.

Example

this.addNewTargetsToAssignment({ assignmentId: string, liveChat: boolean, targets: array<object> })


Parameter

NameTypeDescription
assignmentIdstringAssignment ID
liveChatbooleanDefault true Whether it is a live chat
targetsarrayA list of broadcast group object

Response

Promise<{ member: object, assignmentId: string }>

checkAndSaveMemberReferFrom

The method checkAndSaveMemberReferFrom() is used to check the information about the present channel.

Example

this.checkAndSaveMemberReferFrom({ memberId: string, referFrom: string })


Parameter

NameTypeDescription
memberIdstringStella Member ID
referFromstringChannel that refers member to the current channel

Response

{
  "_id": string
  "createdAt": timestamp
  "updatedAt": timestamp
  "platform": string
  "profile": object
  "meta": object
  "botMeta": object
  "externalId": string
  "botId": string
  "firstName": string
  "gender": string
  "app": string
  "channel": string
  "tags": array<object>
  "_version": number
}

countDataSource

The method countDataSource() is used to count the information about the present channel.

Example

this.countDataSource({ collectionName: string, dataSourceId: string, filter: object })


Parameter

NameTypeDescription
collectionNamestringEither collectionName or dataSourceId. Collection name
dataSourceIdstringEither collectionName or dataSourceId. Data source ID
filterobjectOptional Filter criteria. Shares the same method as MongoDB query. Please see MongoDB for further reference

Response

400 // A number

createAssignment

The method createAssignment() is used to create an assignment to outlet channels.

Example

this.createAssignment({ assignmentDetails: object, createGroup: boolean, history: boolean, groupExternalId: string, label: string, liveChat: boolean, member: object, meta: object, noGroupCreation: boolean, targets: array<object> })


Parameter

NameTypeDescription
assignmentDetailsobjectAssignment details
createGroupbooleanDefault false. Whether this assignment will create group or not
historybooleanDefault false. Whether the Stella conversation histry url is embedded in the assignment
groupExternalIdstringGroup external ID in its specific channel
labelstringBroadcast group label
liveChatbooleanDefault true Whether it is a live chat
memberobjectMember object
metaobjectData that needs to be updated
noGroupCreationbooleanDefault false. Whether the assignment will run group creator and follow your options to create group or not
targetsarrayA list of broadcast group object

Response

Promise<{ member: object, assignmentId: string }>

createTeamsChannel

The method createTeamsChannel() is used to create a Teamwork channel.

Example

this.createTeamsChannel({ channel: string, teamsGroupId: string, displayName: string })


Parameter

NameTypeDescription
channelobjectChannel collection object
teamsGroupIdstringTeamwork group ID
displayNamestringDisplay name of the new channel

Response

{
  "ok": 1
  "result": object
}

createWhatsappGroup

The method createWhatsappGroup() is used to create a Whatsapp group.

Example

this.createWhatsappGroup({ channelId: string, name: string, requireInvitationLink: string })


Parameter

NameTypeDescription
channelIdstringChannel ID
namestringGroup name
requireInvitationLinkbooleanDefault true. Status of the group require invitation link to join

Response

{
  "groupId": string
  "invitationLink": string // If requireInvitationLink === true
}

deleteMemberAgenda

The method deleteMemberAgenda() is used to delete member agenda by Stella member ID.

Example

this.deleteMemberAgenda({ channel: object, memberId: string })


Parameter

NameTypeDescription
memberIdstringStella Member ID
tagstringSpecific agenda name

Response

{
  "clientMutationId": string
}

disableWhatsappGroupInviteLink

The method disableWhatsappGroupInviteLink() is used to disable Whatsapp group invitation links.

Example

this.disableWhatsappGroupInviteLink({ externalId: string, channel: string })


Parameter

NameTypeDescription
channelobjectChannel collection object
externalIdstringGroup ID in Whatsapp

endLiveChat

The method endLiveChat() is used to end the live chat in different channels.

Example

this.endLiveChat({ channel: object, messageEvent: object })


Parameter

NameTypeDescription
channelobjectChannel collection object
messageEventobjectMessage Event object. Please see Message Event documentation for further reference.

endWhatsappLiveChat

The method endWhatsappLiveChat() is used to end the Whatsapp live chat.

Example

this.endWhatsappLiveChat({ adminExternalId: string, whatsappGroupId: string, channel: object, channelId: string })


Parameter

NameTypeDescription
adminExternalIdstringMember ID in Whatsapp
channelobjectChannel collection object
channelIdstringChannel ID
whatsappGroupIdstringWhatsapp group ID

Response

[
  {
    "clientMutationId": string
  },
  {
    "assignmentRaw": object
    "clientMutationId": string
  },
  // // ...
]

fbCreateBroadcast

The method fbCreateBroadcast() is used to create Facebook broadcast for mass promotion.

Example

this.fbCreateBroadcast({ channel: object, response: string })


Parameter

NameTypeDescription
channelobjectChannel collection object
responseobjectResponse object. The structure of the response object can be referred to the Message Event documentation for further reference.

Response

{
  "ok": 1
  "result": [
    {
      "response": object
      "accessToken": string
    }
  ]
}

fbGetAttachmentId

The method fbGetAttachmentId() is used to get Facebook attachment ID when uploading a new attachment.

Example

this.fbGetAttachmentId({ channel: object, type: string, url: string })


Parameter

NameTypeDescription
channelobjectChannel collection object
typeobjectAttachment type
urlstringAttachment URL

Response

{
  "attachment_id": string
}

fbPassThreadControl

The method fbPassThreadControl() is used to pass the conversation control from one app to another.

Example

this.fbPassThreadControl({ member: object, channel: object, targetAppId: string, metadata: string })


Parameter

NameTypeDescription
channelobjectChannel collection object
memberobjectMember collection object
metadatastringData need to be passed in passing the control
targetAppIdstringTarget application ID

Response

{
  "success": true
}

fbRemoveCustomLabel

The method fbRemoveCustomLabel() is used to remove a custom label from a PSID.

Example

this.fbRemoveCustomLabel({ member: object, channel: object, labelId: string })


Parameter

NameTypeDescription
channelobjectChannel collection object
memberobjectMember collection object
labelIdstringLabel ID

Response

{
  "success": true
}

fbSaveCustomLabel

The method fbSaveCustomLabel() is used to save a custom label from a PSID.

Example

this.fbSaveCustomLabel({ member: object, channel: object, labelId: string })


Parameter

NameTypeDescription
channelobjectChannel collection object
memberobjectMember collection object
labelIdstringLabel ID

Response

{
  "id": number
}

fbSendBroadcast

The method fbSendBroadcast() is used to send a broadcast message.

Example

this.fbSendBroadcast({ channel: object, broadcastId: "broadcastId", labelId: string, notificationType: string })


Parameter

NameTypeDescription
channelobjectChannel collection object
broadcastIdobjectBroadcast ID
labelIdstringLabel ID
notificationTypestringNotification Type

Response

{
  "broadcast_id": number
}

fetchDataFromDataSource

The method fetchDataFromDataSource() is used to fetch data from data source.

Example

this.fetchDataFromDataSource({ collectionName: string, dataSourceId: string , filter: object, count: boolean, sortBy: object })


Parameter

NameTypeDescription
collectionNamestringEither collectionName or dataSourceId. Collection name
countbooleanDefault false. Status of this method is performing count feature only
dataSourceIdstringEither collectionName or dataSourceId. Data source ID
filterobjectOptional Filter criteria. Shares the same method as MongoDB query. Please see MongoDB for further reference
sortByobjectOptional Shares the same method as MongoDB query. Please see MongoDB for further reference

Response

[
  {
    "id": string
    // ...
  },
  // ...
]

fetchDistinctDataFromDataSource

The method fetchDistinctDataFromDataSource() is used to fetch distinct data(i.e. the column of the data source table) from data source.

Example

this.fetchDistinctDataFromDataSource({ collectionName: string, dataSourceId: string , filter: object, count: boolean, sortBy: object })


Parameter

NameTypeDescription
collectionNamestringEither collectionName or dataSourceId. Collection name
countbooleanDefault false. Status of this method is performing count feature only
dataSourceIdstringEither collectionName or dataSourceId. Data source ID
keystringThe column you wish to fetch from data source
filterobjectOptional Filter criteria. Shares the same method as MongoDB query. Please see MongoDB for further reference

Response

[
  value of key,
  // ...
]

fetchGeoNearFromDataSource

The method fetchGeoNearFromDataSource() is used to fetch geographical data from data source.

Example

this.fetchGeoNearFromDataSource({ collectionName: string, data: object, dataSourceId: string })


Parameter

NameTypeDescription
collectionNamestringEither collectionName or dataSourceId. Collection name
dataobjectGeo data
dataSourceIdstringEither collectionName or dataSourceId. Data source ID

Response

[
  {
    "id": string
  },
  // ...
]

findAndModifyDataFromDataSource

The method findAndModifyDataFromDataSource() is used to find and modify data from data source. In this call, the patch object will be formatted in this way in the data source table: each object becomes a new row; object key becomes column and object value becomes the value.

Example

this.findAndModifyDataFromDataSource({ collectionName: string, dataSourceId: string, filter: object, patch: object, sortBy: object, option: object, withModifier: boolean })


Parameter

NameTypeDescription
collectionNamestringEither collectionName or dataSourceId. Collection name
dataSourceIdstringEither collectionName or dataSourceId. Data source ID
filterobjectOptional Filter criteria. Shares the same method as MongoDB. Please see MongoDB
optionobjectOptional Shares the same option as MongoDB. Please see MongoDB for further reference
patchobjectData for updating the data source
sortByobjectOptional Shares the same method as MongoDB. Please see MongoDB for further reference
withModifierbooleanDefault false Status of whether this call contains modifier

Response

{
  ok: number
  value: object
}

getAdmin

The method getAdmin() is used to get the current admin.

Example

this.getAdmin({ adminId: string })


Parameter

NameTypeDescription
adminIdstringStella Admin ID

Response

{
  "appId": string
  "adminId": string
  "externalId": string
}

getAdminByExternalId

The method getAdminByExternalId() is used to get the current admin by its member external ID.

Example

this.getAdminByExternalId({ externalId: string })


Parameter

NameTypeDescription
externalIdstringMember ID in its specific channel. Facebook Page scope ID. Whatsapp Country code and phone number. Slack User ID. Wechat Wechat member ID Teamwork Teamwork member ID Webchat Webchat member ID

Response

{
  "appId": string
  "adminId": string
  "externalId": string
}

getAssignment

The method getAssignment() is used to get the current assignment.

Example

this.getAssignment({ assignmentId: string })


Parameter

NameTypeDescription
assignmentIdstringAssignment ID

Response

{
  "_id": string
  "_version": number
  "app": string
  "assignedAt": timestamp
  "assignee": string
  "createdAt": timestamp
  "etag": string
  "expiry": number
  "group": string
  "groupInfo": object
  "history": boolean
  "isZendesk": boolean
  "inlet": string
  "inletGroupInfo": object
  "member": string
  "meta": object
  "relayMessage": object
  "targets": array<object>
  "updatedAt": timestamp
}

getAssignmentByOutlet

The method getAssignmentByOutlet() is used to get the current assignment by the outlet ID. Please note that the meta object is indeed as MongoDB filter operator. Please see MongoDB for further reference.

Example

this.getAssignmentByOutlet({ channelId: string })


Parameter

NameTypeDescription
channelIdstringOutlet channel ID

Response

{
  "_id": string
  "_version": number
  "app": string
  "assignedAt": timestamp
  "assignee": string
  "createdAt": timestamp
  "etag": string
  "expiry": number
  "group": string
  "groupInfo": object
  "history": boolean
  "isZendesk": boolean
  "inlet": string
  "inletGroupInfo": object
  "member": string
  "meta": object
  "relayMessage": object
  "targets": array<object>
  "updatedAt": timestamp
}

getAssignmentByWhatsappGroupId

The method getAssignmentByWhatsappGroupId() is used to get the current assignment by the Whatsapp group ID.

Example

this.getAssignmentByWhatsappGroupId({ whatsappGroupId: string })


Parameter

NameTypeDescription
whatsappGroupIdstringWhatsapp group ID

Response

{
  "_id": string
  "_version": number
  "app": string
  "assignedAt": timestamp
  "assignee": string
  "createdAt": timestamp
  "etag": string
  "expiry": number
  "group": string
  "groupInfo": object
  "history": boolean
  "isZendesk": boolean
  "inlet": string
  "inletGroupInfo": object
  "member": string
  "meta": object
  "relayMessage": object
  "targets": array<object>
  "updatedAt": timestamp
},

getAssignmentsByMemberId

The method getAssignmentsByMeta() is used to get the current assignment by Stella member ID.

Example

this.getAssignmentsByMemberId({ memberId: string })


Parameter

NameTypeDescription
memberIdstringStella Member ID

Response

[
  {
    "_id": string
    "_version": number
    "app": string
    "assignedAt": timestamp
    "assignee": string
    "createdAt": timestamp
    "etag": string
    "expiry": number
    "group": string
    "groupInfo": object
    "history": boolean
    "isZendesk": boolean
    "inlet": string
    "inletGroupInfo": object
    "member": string
    "meta": object
    "relayMessage": object
    "targets": array<object>
    "updatedAt": timestamp
  }
  // ...
]

getAssignmentsByMeta

The method getAssignmentsByMeta() is used to get the current assignment by the meta. Note that you can use

Example

this.getAssignmentsByMeta({ meta: object })


Parameter

NameTypeDescription
metaobjectData that matches the get request

Response

[
  {
    "_id": string
    "_version": number
    "app": string
    "assignedAt": timestamp
    "assignee": string
    "createdAt": timestamp
    "etag": string
    "expiry": number
    "group": string
    "groupInfo": object
    "history": boolean
    "isZendesk": boolean
    "inlet": string
    "inletGroupInfo": object
    "member": string
    "meta": object
    "relayMessage": object
    "targets": array<object>
    "updatedAt": timestamp
  },
  // ...
]

getAssignmentsByParentAssignmentId

The method getAssignmentsByParentAssignmentId() is used to get the current assignment by the assignment ID of its parent.

Example

this.getAssignmentsByParentAssignmentId({ assignmentId: string })


Parameter

NameTypeDescription
assignmentIdstringParent assignment ID

Response

[
  {
    "_id": string
    "_version": number
    "app": string
    "assignedAt": timestamp
    "assignee": string
    "createdAt": timestamp
    "etag": string
    "expiry": number
    "group": string
    "groupInfo": object
    "history": boolean
    "isZendesk": boolean
    "inlet": string
    "inletGroupInfo": object
    "member": string
    "meta": object
    "relayMessage": object
    "targets": array<object>
    "updatedAt": timestamp
  },
  // ...
]

getChannel

The method getChannel() is used to get the information about the present channel.

Example

this.getChannel({ channelId: string })


Parameter

NameTypeDescription
channelIdstringThe channel ID that you have

Response

{
  "channelId": string
  "appId": string
}

getGroup

The method getGroup() is used to get the information about the present group.

Example

this.getGroup({ groupId: string })


Parameter

NameTypeDescription
groupIdstringGroup ID

Response

{
  "_id": string
  "createdAt": timestamp
  "inlet": string
  "outlet": string
  "name": string
  "meta": object
  "valid": boolean
  "externalId": string
  "botId": string
  "type": string
  "adminExternalId": string
  "app": string
  "assignment": string
  "member": string
  "admin": string
  "_version": number
}

getGroupByExternalId

The method getGroupByExternalId() is used to get the information about the present group.

Example

this.getGroupByExternalId({ adminExternalId: string, type: string, channelId: "string })


Parameter

NameTypeDescription
adminExternalIdstringMember ID in its specific channel. Facebook Page scope ID. Whatsapp Country code and phone number. Slack User ID. Wechat Wechat member ID Teamwork Teamwork member ID Webchat Webchat member ID
channelIdstringChannel ID
typestringOptional Channel type

Response

{
  "_id": string
  "createdAt": timestamp
  "inlet": string
  "outlet": string
  "name": string
  "meta": object
  "valid": boolean
  "externalId": string
  "botId": string
  "type": string
  "adminExternalId": string
  "app": string
  "assignment": string
  "member": string
  "admin": string
  "_version": number
}

getGroupByGroupExternalId

The method getGroupByGroupExternalId() is used to get the information about the present group.

Example

this.getGroupByGroupExternalId({ groupExternalId: string })


Parameter

NameTypeDescription
groupExternalIdstringGroup ID in its specific channel

Response

{
  "_id": string
  "createdAt": timestamp
  "inlet": string
  "outlet": string
  "name": string
  "meta": object
  "valid": boolean
  "externalId": string
  "botId": string
  "type": string
  "adminExternalId": string
  "app": string
  "assignment": string
  "member": string
  "admin": string
  "_version": number
}

getGroupByInletGroup

The method getGroupByInletGroup() is used to get the information about the present group.

Example

this.getGroupByInletGroup({ inletGroupExternalId: string, inlet: string })


Parameter

NameTypeDescription
inletstringInlet ID
inletGroupExternalIdstringInlet group ID in its specific channel

Response

{
  "_id": string
  "createdAt": timestamp
  "inlet": string
  "outlet": string
  "name": string
  "meta": object
  "valid": boolean
  "externalId": string
  "botId": string
  "type": string
  "adminExternalId": string
  "app": string
  "assignment": string
  "member": string
  "admin": string
  "_version": number
}

getGroupByInletGroup

The method getGroupByInletGroup() is used to get the information about the present group.

Example

this.getGroupByInletGroup({ inletGroupExternalId: string, inlet: string })


Parameter

NameTypeDescription
inletstringInlet ID
inletGroupExternalIdstringInlet group ID in its specific channel

Response

{
  "_id": string
  "createdAt": timestamp
  "inlet": string
  "outlet": string
  "name": string
  "meta": object
  "valid": boolean
  "externalId": string
  "botId": string
  "type": string
  "adminExternalId": string
  "app": string
  "assignment": string
  "member": string
  "admin": string
  "_version": number
}

getGroupByMemberId

The method getGroupByMemberId() is used to get the information about the present group.

Example

this.getGroupByMemberId({ inlet: string, memberId: string })


Parameter

NameTypeDescription
inletstringStella Inlet ID
memberIdstringStella Member ID

Response

{
  "_id": string
  "createdAt": timestamp
  "inlet": string
  "outlet": string
  "name": string
  "meta": object
  "valid": boolean
  "externalId": string
  "botId": string
  "type": string
  "adminExternalId": string
  "app": string
  "assignment": string
  "member": string
  "admin": string
  "_version": number
}

getMember

The method getMember() is used to get the information about the present member from its Stella member ID.

Example

this.getMember({ memberId: string })


Parameter

NameTypeDescription
memberIdstringStella Member ID

Response

{
  "_id": string
  "_version": number
  "app": string
  "botId": string
  "botMeta": object
  "channel": string
  "createdAt": timestamp
  "etag": string
  "externalId": string
  "firstName": string
  "gender": string
  "meta": object
  "platform": string
  "profile": object
  "tags": array<object>
  "updatedAt": timestamp
}

handleAdminJoinedGroup

The method handleAdminJoinedGroup() is used to 1. create group in database, 2. deactivate the group invitation and 3. renew the group invitation link after the admin has joined the Whatsapp group.

Example

this.handleAdminJoinedGroup({ channel: object, externalId: string, whatsappGroupId: string, isRenewGroupInviteLink: boolean })


Parameter

NameTypeDescription
channelobjectChannel collection object
externalIdstringMember ID in its specific channel
isRenewGroupInviteLinkbooleanDefault true. Renew the group invitation link
whatsappGroupIdWhatsapp Group ID

Response

string // URL of the group invitation link

inactivateGroup

The method inactivateGroup() can be used to inactivate live chat group.

Example

this.inactivateGroup({ groupId: string })


Parameter

NameTypeDescription
groupIdstringLive chat group ID

Response

{
  "_id": string
  "email": object
  "createdAt": timestamp
  "apps": array<object>
  "acls": array<string>
  "_version": number
} // the updated group object

inletEndLiveChat

The method inactivateGroup() can be used to end the live chat from the inlet. Please note that the these is a default falsy option recallRelayMessage. If recallRelayMessage is truthy, it will recall the ticket sent to outlet channel's ticketing group, currently support slack and teamwork

Example

this.inletEndLiveChat({ channel: object, member: object, options: object })


Parameter

NameTypeDescription
channelobjectChannel object
memberobjectMember object
optionsobjectRequest option

Response

{
  "_id": string
  "email": object
  "createdAt": timestamp
  "apps": array<object>
  "acls": array<string>
  "_version": number
} // the updated group object

newAgenda

The method newAgenda() can be used to create new agenda. The response will be different if the replace option is on.

Example

this.newAgenda({ meta: object, memberId: string, nextRunAt: number, nodeCompositeId: string, priority: number, pattern: string, replace: boolean, runUntil: number, tag: string, treeId: string })


Parameter

NameTypeDescription
memberIdstringStella Member ID
metaobjectThe data wish to send inside the agenda
nodeCompositeIdstringNode Composite ID
nextRunAtnumberTime for running the next agenda in milliseconds. This property will override the pattern property
patternstringCRON Pattern of the agenda
prioritynumberThe priority of the agenda
runUntilnumberTimestamp for running the agenda until it stops
replacebooleanDefault false. Whether the input is replaced
treeIdstringTree ID
tagstringMember tag

Response

{  
  // replace = true
  "returnNewDocument": boolean
  "agenda": object

  // replace = false
  "docs": object
  "totalCount": number
  "docIds": string
}

patchDataToDataSource

The method patchDataToDataSource() can be used to patch data to data source. In this call, the patch object will be formatted in this way in the data source table: each object becomes a new row; object key becomes column and object value becomes the value.

Example

this.patchDataToDataSource({ collectionName: string, dataSourceId: string, filter: object, patch: object, options: object, multi: boolean, withModifier: boolean })


Parameter

NameTypeDescription
collectionNamestringEither collectionName or dataSourceId. Collection Name
dataSourceIdstringEither collectionName or dataSourceId. Data Soruce ID
filterobjectOptional Filter criteria. Shares the same method as MongoDB query. Please see MongoDB for further reference
multibooleanOptional Whether update multiple fields
optionsobjectOptions for the request
patchobjectThe field and data that needs to be patched
withModifierbooleanDefault false Status the method contains modifier

Response

{
  "matched": number
  "modified": number
  "inserted": number
  "deleted": number
}

patchMembers

The method patchMembers() can be used to patch data to members.

Example

this.patchMembers({ channel: object, memberId: string, filter: object, patch: object, withModifier: boolean })


Parameter

NameTypeDescription
channelobjectChannel object
filterobjectOptional Filter criteria. Shares the same method as MongoDB query. Please see MongoDB for further reference
memberIdstringStella Member ID
patchobjectThe field and data that needs to be patched
withModifierbooleanDefault false Status the method contains modifier

Response

{  
  "result": {
    "_id": string
    "createdAt": timestamp
    "updatedAt": timestamp
    "profile": object
    // ...
  }
}

reassignAssignment

The method reassignAssignment() can be used to reassign the assignment within or in other channels. Only available to Whatsapp, Slack and Teamwork.

Example

this.reassignAssignment({ channel: object, groupName: string, label: string, liveChat: boolean, inletGroup: boolean, meta: object, messageEvent: object, previousAssignment: object, relayMessage: string, summary: string, takenMessage: string, targets: array<object> })


ParameterTypeDescription
channelobjectChannel object
groupNamestringGroup name shown in the outlet group. Whataspp Whatsapp group name. Slack Channel name. Teamwork Teamwork group name.
labelstringBroadcast group label
liveChatbooleanDefault true Whether it is a live chat
inletGroupbooleanDefault false Whether it is a inlet group condition.
metaobjectData that needs to be updated
messageEventobjectMessage Event object. Please see Message Event documentation for further reference.
previousAssignmentobjectPrevious assignment object
relayMessagestringPreviewed message in the outlet channel
summarystringSummary of the assignment which sends to the ticket taker
takenMessagestringSlack only Message shown after taking the ticket
targetsarrayA list of broadcast group object

Response

Promise<{ member: object, assignmentId: string }>

redirectMemberToNode

The method redirectMemberToNode() can be used to redirect member to other nodes so that chat bot flow can be continued.

Example

this.redirectMemberToNode({ channelId: string, memberId: string, nodeCompositeId: string, treeId: string, redirectOptions: string, meta: string })


ParameterTypeDescription
channelIdstringChannel ID
memberIdstringStella Member ID
nodeCompositeIdstringNode composite ID
treeIdstringTree ID
redirectOptionsobjectRedirect options
metaobjectData that needs to be updated

Response

{
  "clientMutationId": string
}

removePendingAssignmentByMemberId

The method removePendingAssignmentByMemberId() can be used to remove the pending assignment according to the member ID.

Example

this.removePendingAssignmentByMemberId({ memberId: string })


ParameterTypeDescription
memberIdstringStella Member ID

Response

{
  "clientMutationId": string
}

saveGroupIdToMember

The method saveGroupIdToMember() can be used to save the Facebook post comment analytics.

Example

this.saveGroupIdToMember({ channel: object, messageEvent: object })


ParameterTypeDescription
channelobjectChannel object
messageEventobjectMessage Event object. Please see Message Event documentation for further reference.

Response

{
  "clientMutationId": string
}

savePostCommentAnalytics

The method savePostCommentAnalytics() can be used to save the Facebook post comment analytics.

Example

this.savePostCommentAnalytics({ comment: string, channelId: string, fbId: string, isMatched: boolean, memberId: string, name: string, postId: string })


ParameterTypeDescription
commentstringContent of the comment
channelIdstringChannel ID
fbIdstringUnique user ID for users who comment on post
isMatchedbooleanDefault false. Set to true if it's the correct comment trigger; set to false if it's the wrong comment trigger.
memberIdstringStella Member ID
namestringUser name
postIdstringFacebook post ID

Response

{
  "clientMutationId": string
}

sendEmail

The method sendEmail() can be used to send email through Amazon SES service from no-reply@sanuker.com. This method returns nothing from our API.

Example

const params = {
  Destination: {
    CcAddresses: ["sample@sanuker.com", "sample2@sanuker.com"],
    ToAddresses: ["sameple3@sanuker.com", "sameple4@sanuker.com"]
  },
  Message: {
    Body: {
      Html: {
        Charset: "UTF-8",
        Data: "HTML_FORMAT_BODY"
      },
      Text: {
        Charset: "UTF-8",
        Data: "TEXT_FORMAT_BODY"
      }
    },
    Subject: {
      Charset: 'UTF-8',
      Data: 'Test email'
    }
  }
}

this.sendEmail(params)


ParameterTypeDescription
destinationobjectThe email address you want to send and CC to.
messageobjectThe subject and message(in either HTML or Text format) you want to have in the email.

sendFbResponse

The method sendFbResponse() can send Facebook response.

Example

this.sendFbResponse({ channel: object, channelId: string, member: object, memberId: string, response: object })


ParameterTypeDescription
channelobjectChannel object
channelIdstringChannel ID
memberobjectMember object
memberIdstringStella Member ID
responseobjectMessage Event object. Please see Message Event documentation for further reference.

Response

{
  "result": object
  "messageEvent": object
}

sendFbResponseToMemberIds

The method sendFbResponseToMemberIds() can send Facebook response to several members.

Example

this.sendFbResponseToMemberIds({ channel: object, channelId: string, memberId: string, response: object })


ParameterTypeDescription
channelobjectChannel object
channelIdstringChannel ID
memberIdarrayA set of Stella member IDs
responseobjectMessage Event object. Please see Message Event documentation for further reference.

Response

[
  {
    "result": object
    "messageEvent": object
  },
  // ...
]

sendMessageToInlet

The method sendMessageToInlet() can send to the inlet channel.

Example

this.sendMessageToInlet({ channel: object, messageEvent: object, response: object })


ParameterTypeDescription
channelobjectChannel object
messageEventobjectMessage Event object. Please see Message Event documentation for further reference.
responseobjectResponse object. The structure of the response object can be referred to the Message Event documentation for further reference.

Response

// Facebook
{
  "result": object
  "messageEvent": object
}

// Whatsapp
{
  "result": object
  "messageEvent": object
}

// Slack
{
  "ok": boolean
  "channel": string
  "ts": timestamp
  "message": object
}

// Teams
{
  "result": object
  "messageEvent": object
}

// Webchat
{
  "result": object
  "messageEvent": object
}

// Wechat
{
  "msgType": string
  "url: string
  "image": object
  "text": object
  "video": object
  "title": string
  "description": string
  "news" string
}

sendMessageToInletGroup

The method sendMessageToInletGroup() can send to the inlet channel's group. This method is only available for Teamwork and Whatsapp.

Example

this.sendMessageToInlet({ group: object, groupId: string, response: object })


ParameterTypeDescription
groupobjectGroup object
groupIdobjectGroup ID
responseobjectResponse object. The structure of the response object can be referred to the Message Event documentation for further reference.

Response

// Whatsapp
{
  "result": object
  "messageEvent": object
}

// Teamwork
{
  "result": object
  "messageEvent": object
}

sendMessageToOutletGroup

The method sendMessageToInletGroup() can send to the outlet channel's group. This method is only available for Teamwork, Whatsapp and Slack.

Example

this.sendMessageToInlet({ group: object, groupId: string, response: object })


ParameterTypeDescription
groupobjectGroup object
groupIdobjectInlet group ID
responseobjectResponse object. The structure of the response object can be referred to the Message Event documentation for further reference.
responseUrlstringSlack onlyResponse URL is used in an interactive components. This allow the components to make a POST request and publish the message back to place where interaction happened. Please see [SlacK] https://api.slack.com/interactivity/handling documentation about App Interactivity for further reference.

Response

// Whatsapp
{
  "result": object
  "messageEvent": object
}

// Slack
{
  "ok": boolean
  "channel": string
  "ts": timestamp
  "message": object
}

// Teamwork
{
  "result": object
  "messageEvent": object
}

sendResponse

The method sendResponse() can send response in different channels.

Example

this.sendResponse({ channel: object, channelId: string, memberId: string, response: object })


ParameterTypeDescription
channelobjectChannel object
channelIdstringChannel ID
memberobjectMember object
memberIdarrayA set of Stella member IDs
responseobjectResponse object. The structure of the response object can be referred to the Message Event documentation for further reference.
messagingTypestringFacebook only Messaging type
messagingTagstringFacebook only Messaging tag

Response

// Facebook
{
  "result": object
  "messageEvent": object
}

// Whatsapp
{
  "result": object
  "messageEvent": object
}

// Slack
{
  "ok": boolean
  "channel": string
  "ts": timestamp
  "message": object
}

// Teams
{
  "result": object
  "messageEvent": object
}

// Webchat
{
  "result": object
  "messageEvent": object
}

// Wechat
{
  "msgType": string
  "url: string
  "image": object
  "text": object
  "video": object
  "title": string
  "description": string
  "news" string
}

sendTeamsResponse

The method sendTeamsResponse() can send response in teams.

Example

this.sendTeamsResponse({ channel: object, response: object, recipientId: string, receiverType: string, teamsGroupId: string })


ParameterTypeDescription
channelobjectChannel object
responseobjectResponse object. The structure of the response object can be referred to the Message Event documentation for further reference.
recipientIdstringRecipient ID
receiverTypestringRecipient type
teamsGroupIdstringTeams group ID

Response

{
  "result": object
  "messageEvent": object
}

sendTeamworkResponse

The method sendTeamworkResponse() can send response in teamwork.

Example

this.sendTeamworkResponse({ channel: object, channelId: string, member: object, memberId: string, response: object })


ParameterTypeDescription
ParameterTypeDescription
---------
channelobjectChannel object
channelIdstringChannel ID
memberobjectMember object
memberIdarrayA set of Stella member IDs
responseobjectMessage Event object. Please see Message Event documentation for further reference.

Response

{
  "id": string
  "STATUS": string
}

setWhatsappGroupIcon

The method setWhatsappGroupIcon() can set the set the Whatsapp group icon. Usually used in a live chat conversation.

Example

this.setWhatsappGroupIcon({ channelId: string, imageUrl: string, whatsappGroupId: string })


ParameterTypeDescription
channelIdstringChannel ID
imageUrlstringImage URL
whatsappGroupIdstringWhatsapp group ID

Response

{
  "200": "ok"
}

slackArchiveConversation

The method slackArchiveConversation() can archive Slack's conversation. Usually used in ending a live chat conversation.

Example

this.slackArchiveConversation({ channel: object, messageEvent: object })


ParameterTypeDescription
channelobjectChannel object
messageEventobjectMessage Event object. Please see Message Event documentation for further reference.

Response

{
  "ok": boolean
}

stripe

The method stripe() can help get the stripe object from npm package stripe-node. Please see the stripe-node documentation for further reference. This method returns nothing from our API.

Example

this.stripe({ stripeName: "sample-stripe" })


ParameterTypeDescription
stripeNamestringYour Stripe ID

updateAgenda

The method updateAgenda() can update the agenda in the database.

Example

this.updateAgenda({ memberId: string, meta: object, nextRunAt: number, nodeCompositeId: string, priority: number, pattern: string, replace: boolean, runUntil: number, tag: string, treeId: string })


ParameterTypeDescription
memberIdstringStella Member ID
metaobjectThe data wish to send inside the agenda
nodeCompositeIdstringNode Composite ID
nextRunAtnumberTime for running the next agenda in milliseconds. This property will override the pattern property
patternstringCRON Pattern of the agenda
prioritynumberThe priority of the agenda
runUntilnumberTimestamp for running the agenda until it stops
replacebooleanDefault false. Whether the input is replaced
treeIdstringTree ID
tagstringMember tag

Response

{
  "_docsIds": {
    "updated": array<string>
  },
  "_docs": array<object>
  "modified": number
}

updateAssignmentGroup

The method updateAssignmentGroup() can update the assignment's group information in the database.

Example

this.updateAssignmentGroup({ assignmentId: string, group: object, whatsappGroupId: string })


ParameterTypeDescription
assignmentIdstringAssignment ID
groupobjectGroup object
whatsappGroupIdstirngWhatsapp group ID

Response

{
  "_docsIds": {
    "updated": array<string>
  },
  "_docs": array<object>
  "modified": number
}

updateAssignmentMeta

The method updateAssignmentMeta() can update the assignment meta in the database.

Example

this.updateAssignmentMeta({ assignmentId: string, meta: object })


ParameterTypeDescription
assignmentIdstringAssignment ID
metaobjectData that needs to be updated

Response

{
  "_docsIds": {
    "updated": array<string>
  },
  "_docs": array<object>
  "modified": number
}

updateGroup

The method updateGroup() can update the group data in the database.

Example

this.updateGroup({ group: object })


ParameterTypeDescription
groupobjectUpdated group object

Response

{
  "_docsIds": {
    "updated": array<string>
  },
  "_docs": array<object>
  "modified": number
}

updateGroupMeta

The method updateGroupMeta() can update the group's meta data in the database.

Example

this.updateGroupMeta({ groupId: string, meta: object })


ParameterTypeDescription
metaobjectData that needs to be updated

Response

{
  "_docsIds": {
    "updated": array<string>
  },
  "_docs": array<object>
  "modified": number
}

updateMember

The method updateMember() can the member's information in the database.

Example

this.updateMember({ member: object })


ParameterTypeDescription
memberobjectMember object

Response

{
  "_docsIds": {
    "updated": array<string>
  },
  "_docs": object
  "modified": number
}

updateMessage

The method updateMessage() can archive Slack's conversation. Usually used in ending a live chat conversation.

Example

this.updateMessage({ attachments: array<object>, channel: object, externalChannelId: string, messageEvent: object, text: string })


ParameterTypeDescription
attachmentsarrayAttachments to be updated
externalChannelIdExternal channel ID
channelobjectChannel object
messageTsstringMessage timestamp
textstringText to be updated

Response

{
  "ok": boolean
  "channel": string
  "ts": timestamp
  "text": "Updated text you carefully authored"
}

uploadFileToS3

The method uploadFileToS3() can upload file to our S3 server. Please note that this method return nothing.

Example

this.stripe({ url: string, options: object, channel: object, filename: string, contentType: string })


ParameterTypeDescription
urlstringURL of the file
optionsobjectOption of the request
channelstringChannel Object
filenamestringName of the file
contentTypestringContent type of the file

upsertDataToDataSource

The method upsertDataToDataSource() will insert data in the data source. In this call, the data object will be formatted in this way in the data source table: each object becomes a new row; object key becomes column and object value becomes the value.

Example

this.upsertDataToDataSource({ collectionName: string, dataSourceId: string, data: object })


ParameterTypeDescription
collectionNamestringEither collectionName or dataSourceId. Collection name in the data source
dataSourceIdstringEither collectionName or dataSourceId. Data source ID
dataobjectData you want to update or insert

Response

{
  "result": {
    "matched": number
    "modified": number
    "inserted": number
    "deleted": number
  }
}

wechatSaveMemberTag

The method wechatSaveMemberTag() can save member tag in wechat. Please note that a maximum of 20 tags can be set for a user under an Weixin official account.

Example

this.wechatSaveMemberTag({ member: object, channel: object, tagId: number })


ParameterTypeDescription
channelobjectChannel collection object
memberobjectMember collection object
tagIdnumberTag ID

Response

{
  "errcode": number
  "errmsg": string
}
← GroupIntroduction and Prerequisite →
  • 3rd party library methods
  • Custom methods provided by Stella
    • addNewTargetsToAssignment
    • checkAndSaveMemberReferFrom
    • countDataSource
    • createAssignment
    • createTeamsChannel
    • createWhatsappGroup
    • deleteMemberAgenda
    • disableWhatsappGroupInviteLink
    • endLiveChat
    • endWhatsappLiveChat
    • fbCreateBroadcast
    • fbGetAttachmentId
    • fbPassThreadControl
    • fbRemoveCustomLabel
    • fbSaveCustomLabel
    • fbSendBroadcast
    • fetchDataFromDataSource
    • fetchDistinctDataFromDataSource
    • fetchGeoNearFromDataSource
    • findAndModifyDataFromDataSource
    • getAdmin
    • getAdminByExternalId
    • getAssignment
    • getAssignmentByOutlet
    • getAssignmentByWhatsappGroupId
    • getAssignmentsByMemberId
    • getAssignmentsByMeta
    • getAssignmentsByParentAssignmentId
    • getChannel
    • getGroup
    • getGroupByExternalId
    • getGroupByGroupExternalId
    • getGroupByInletGroup
    • getGroupByInletGroup
    • getGroupByMemberId
    • getMember
    • handleAdminJoinedGroup
    • inactivateGroup
    • inletEndLiveChat
    • newAgenda
    • patchDataToDataSource
    • patchMembers
    • reassignAssignment
    • redirectMemberToNode
    • removePendingAssignmentByMemberId
    • saveGroupIdToMember
    • savePostCommentAnalytics
    • sendEmail
    • sendFbResponse
    • sendFbResponseToMemberIds
    • sendMessageToInlet
    • sendMessageToInletGroup
    • sendMessageToOutletGroup
    • sendResponse
    • sendTeamsResponse
    • sendTeamworkResponse
    • setWhatsappGroupIcon
    • slackArchiveConversation
    • stripe
    • updateAgenda
    • updateAssignmentGroup
    • updateAssignmentMeta
    • updateGroup
    • updateGroupMeta
    • updateMember
    • updateMessage
    • uploadFileToS3
    • upsertDataToDataSource
    • wechatSaveMemberTag
Stella Platform Documentation
Docs
Get StartedBest PracticesAPI Reference
Community
FAQUser ShowcaseChat with Us
Copyright © 2020 Sanuker Inc. Limited