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
Property | Type | Description |
---|---|---|
fetch | function | Please see the node-fetch documentation for further reference. |
moment | function | Please see the moment documentation for further reference. |
lodash | function | Please 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
Name | Type | Description |
---|---|---|
assignmentId | string | Assignment ID |
liveChat | boolean | Default true Whether it is a live chat |
targets | array | A 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
Name | Type | Description |
---|---|---|
memberId | string | Stella Member ID |
referFrom | string | Channel 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
Name | Type | Description |
---|---|---|
collectionName | string | Either collectionName or dataSourceId. Collection name |
dataSourceId | string | Either collectionName or dataSourceId. Data source ID |
filter | object | Optional 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
Name | Type | Description |
---|---|---|
assignmentDetails | object | Assignment details |
createGroup | boolean | Default false . Whether this assignment will create group or not |
history | boolean | Default false . Whether the Stella conversation histry url is embedded in the assignment |
groupExternalId | string | Group external ID in its specific channel |
label | string | Broadcast group label |
liveChat | boolean | Default true Whether it is a live chat |
member | object | Member object |
meta | object | Data that needs to be updated |
noGroupCreation | boolean | Default false . Whether the assignment will run group creator and follow your options to create group or not |
targets | array | A 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
Name | Type | Description |
---|---|---|
channel | object | Channel collection object |
teamsGroupId | string | Teamwork group ID |
displayName | string | Display 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
Name | Type | Description |
---|---|---|
channelId | string | Channel ID |
name | string | Group name |
requireInvitationLink | boolean | Default 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
Name | Type | Description |
---|---|---|
memberId | string | Stella Member ID |
tag | string | Specific 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
Name | Type | Description |
---|---|---|
channel | object | Channel collection object |
externalId | string | Group 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
Name | Type | Description |
---|---|---|
channel | object | Channel collection object |
messageEvent | object | Message 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
Name | Type | Description |
---|---|---|
adminExternalId | string | Member ID in Whatsapp |
channel | object | Channel collection object |
channelId | string | Channel ID |
whatsappGroupId | string | Whatsapp 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
Name | Type | Description |
---|---|---|
channel | object | Channel collection object |
response | object | Response 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
Name | Type | Description |
---|---|---|
channel | object | Channel collection object |
type | object | Attachment type |
url | string | Attachment 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
Name | Type | Description |
---|---|---|
channel | object | Channel collection object |
member | object | Member collection object |
metadata | string | Data need to be passed in passing the control |
targetAppId | string | Target 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
Name | Type | Description |
---|---|---|
channel | object | Channel collection object |
member | object | Member collection object |
labelId | string | Label 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
Name | Type | Description |
---|---|---|
channel | object | Channel collection object |
member | object | Member collection object |
labelId | string | Label 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
Name | Type | Description |
---|---|---|
channel | object | Channel collection object |
broadcastId | object | Broadcast ID |
labelId | string | Label ID |
notificationType | string | Notification 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
Name | Type | Description |
---|---|---|
collectionName | string | Either collectionName or dataSourceId. Collection name |
count | boolean | Default false . Status of this method is performing count feature only |
dataSourceId | string | Either collectionName or dataSourceId. Data source ID |
filter | object | Optional Filter criteria. Shares the same method as MongoDB query. Please see MongoDB for further reference |
sortBy | object | Optional 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
Name | Type | Description |
---|---|---|
collectionName | string | Either collectionName or dataSourceId. Collection name |
count | boolean | Default false . Status of this method is performing count feature only |
dataSourceId | string | Either collectionName or dataSourceId. Data source ID |
key | string | The column you wish to fetch from data source |
filter | object | Optional 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
Name | Type | Description |
---|---|---|
collectionName | string | Either collectionName or dataSourceId. Collection name |
data | object | Geo data |
dataSourceId | string | Either 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
Name | Type | Description |
---|---|---|
collectionName | string | Either collectionName or dataSourceId. Collection name |
dataSourceId | string | Either collectionName or dataSourceId. Data source ID |
filter | object | Optional Filter criteria. Shares the same method as MongoDB. Please see MongoDB |
option | object | Optional Shares the same option as MongoDB. Please see MongoDB for further reference |
patch | object | Data for updating the data source |
sortBy | object | Optional Shares the same method as MongoDB. Please see MongoDB for further reference |
withModifier | boolean | Default 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
Name | Type | Description |
---|---|---|
adminId | string | Stella 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
Name | Type | Description |
---|---|---|
externalId | string | Member 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
Name | Type | Description |
---|---|---|
assignmentId | string | 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
}
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
Name | Type | Description |
---|---|---|
channelId | string | Outlet 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
Name | Type | Description |
---|---|---|
whatsappGroupId | string | Whatsapp 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
Name | Type | Description |
---|---|---|
memberId | string | Stella 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
Name | Type | Description |
---|---|---|
meta | object | Data 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
Name | Type | Description |
---|---|---|
assignmentId | string | Parent 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
Name | Type | Description |
---|---|---|
channelId | string | The 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
Name | Type | Description |
---|---|---|
groupId | string | Group 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
Name | Type | Description |
---|---|---|
adminExternalId | string | Member 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 |
channelId | string | Channel ID |
type | string | Optional 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
Name | Type | Description |
---|---|---|
groupExternalId | string | 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
Name | Type | Description |
---|---|---|
inlet | string | Inlet ID |
inletGroupExternalId | string | Inlet 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
Name | Type | Description |
---|---|---|
inlet | string | Inlet ID |
inletGroupExternalId | string | Inlet 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
Name | Type | Description |
---|---|---|
inlet | string | Stella Inlet ID |
memberId | string | Stella 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
Name | Type | Description |
---|---|---|
memberId | string | Stella 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
Name | Type | Description |
---|---|---|
channel | object | Channel collection object |
externalId | string | Member ID in its specific channel |
isRenewGroupInviteLink | boolean | Default true . Renew the group invitation link |
whatsappGroupId | Whatsapp 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
Name | Type | Description |
---|---|---|
groupId | string | Live 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
Name | Type | Description |
---|---|---|
channel | object | Channel object |
member | object | Member object |
options | object | Request 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
Name | Type | Description |
---|---|---|
memberId | string | Stella Member ID |
meta | object | The data wish to send inside the agenda |
nodeCompositeId | string | Node Composite ID |
nextRunAt | number | Time for running the next agenda in milliseconds. This property will override the pattern property |
pattern | string | CRON Pattern of the agenda |
priority | number | The priority of the agenda |
runUntil | number | Timestamp for running the agenda until it stops |
replace | boolean | Default false . Whether the input is replaced |
treeId | string | Tree ID |
tag | string | Member 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
Name | Type | Description |
---|---|---|
collectionName | string | Either collectionName or dataSourceId. Collection Name |
dataSourceId | string | Either collectionName or dataSourceId. Data Soruce ID |
filter | object | Optional Filter criteria. Shares the same method as MongoDB query. Please see MongoDB for further reference |
multi | boolean | Optional Whether update multiple fields |
options | object | Options for the request |
patch | object | The field and data that needs to be patched |
withModifier | boolean | Default 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
Name | Type | Description |
---|---|---|
channel | object | Channel object |
filter | object | Optional Filter criteria. Shares the same method as MongoDB query. Please see MongoDB for further reference |
memberId | string | Stella Member ID |
patch | object | The field and data that needs to be patched |
withModifier | boolean | Default 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> })
Parameter | Type | Description |
---|---|---|
channel | object | Channel object |
groupName | string | Group name shown in the outlet group. Whataspp Whatsapp group name. Slack Channel name. Teamwork Teamwork group name. |
label | string | Broadcast group label |
liveChat | boolean | Default true Whether it is a live chat |
inletGroup | boolean | Default false Whether it is a inlet group condition. |
meta | object | Data that needs to be updated |
messageEvent | object | Message Event object. Please see Message Event documentation for further reference. |
previousAssignment | object | Previous assignment object |
relayMessage | string | Previewed message in the outlet channel |
summary | string | Summary of the assignment which sends to the ticket taker |
takenMessage | string | Slack only Message shown after taking the ticket |
targets | array | A 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 })
Parameter | Type | Description |
---|---|---|
channelId | string | Channel ID |
memberId | string | Stella Member ID |
nodeCompositeId | string | Node composite ID |
treeId | string | Tree ID |
redirectOptions | object | Redirect options |
meta | object | Data 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 })
Parameter | Type | Description |
---|---|---|
memberId | string | Stella 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 })
Parameter | Type | Description |
---|---|---|
channel | object | Channel object |
messageEvent | object | Message 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 })
Parameter | Type | Description |
---|---|---|
comment | string | Content of the comment |
channelId | string | Channel ID |
fbId | string | Unique user ID for users who comment on post |
isMatched | boolean | Default false . Set to true if it's the correct comment trigger; set to false if it's the wrong comment trigger. |
memberId | string | Stella Member ID |
name | string | User name |
postId | string | Facebook 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)
Parameter | Type | Description |
---|---|---|
destination | object | The email address you want to send and CC to. |
message | object | The 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 })
Parameter | Type | Description |
---|---|---|
channel | object | Channel object |
channelId | string | Channel ID |
member | object | Member object |
memberId | string | Stella Member ID |
response | object | Message 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 })
Parameter | Type | Description |
---|---|---|
channel | object | Channel object |
channelId | string | Channel ID |
memberId | array | A set of Stella member IDs |
response | object | Message 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 })
Parameter | Type | Description |
---|---|---|
channel | object | Channel object |
messageEvent | object | Message Event object. Please see Message Event documentation for further reference. |
response | object | Response 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 })
Parameter | Type | Description |
---|---|---|
group | object | Group object |
groupId | object | Group ID |
response | object | Response 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 })
Parameter | Type | Description |
---|---|---|
group | object | Group object |
groupId | object | Inlet group ID |
response | object | Response object. The structure of the response object can be referred to the Message Event documentation for further reference. |
responseUrl | string | Slack only Response 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 })
Parameter | Type | Description |
---|---|---|
channel | object | Channel object |
channelId | string | Channel ID |
member | object | Member object |
memberId | array | A set of Stella member IDs |
response | object | Response object. The structure of the response object can be referred to the Message Event documentation for further reference. |
messagingType | string | Facebook only Messaging type |
messagingTag | string | Facebook 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 })
Parameter | Type | Description |
---|---|---|
channel | object | Channel object |
response | object | Response object. The structure of the response object can be referred to the Message Event documentation for further reference. |
recipientId | string | Recipient ID |
receiverType | string | Recipient type |
teamsGroupId | string | Teams 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 })
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
--- | --- | --- |
channel | object | Channel object |
channelId | string | Channel ID |
member | object | Member object |
memberId | array | A set of Stella member IDs |
response | object | Message 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 })
Parameter | Type | Description |
---|---|---|
channelId | string | Channel ID |
imageUrl | string | Image URL |
whatsappGroupId | string | Whatsapp 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 })
Parameter | Type | Description |
---|---|---|
channel | object | Channel object |
messageEvent | object | Message 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" })
Parameter | Type | Description |
---|---|---|
stripeName | string | Your 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 })
Parameter | Type | Description |
---|---|---|
memberId | string | Stella Member ID |
meta | object | The data wish to send inside the agenda |
nodeCompositeId | string | Node Composite ID |
nextRunAt | number | Time for running the next agenda in milliseconds. This property will override the pattern property |
pattern | string | CRON Pattern of the agenda |
priority | number | The priority of the agenda |
runUntil | number | Timestamp for running the agenda until it stops |
replace | boolean | Default false . Whether the input is replaced |
treeId | string | Tree ID |
tag | string | Member 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 })
Parameter | Type | Description |
---|---|---|
assignmentId | string | Assignment ID |
group | object | Group object |
whatsappGroupId | stirng | Whatsapp 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 })
Parameter | Type | Description |
---|---|---|
assignmentId | string | Assignment ID |
meta | object | Data 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 })
Parameter | Type | Description |
---|---|---|
group | object | Updated 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 })
Parameter | Type | Description |
---|---|---|
meta | object | Data 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 })
Parameter | Type | Description |
---|---|---|
member | object | Member 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 })
Parameter | Type | Description |
---|---|---|
attachments | array | Attachments to be updated |
externalChannelId | External channel ID | |
channel | object | Channel object |
messageTs | string | Message timestamp |
text | string | Text 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 })
Parameter | Type | Description |
---|---|---|
url | string | URL of the file |
options | object | Option of the request |
channel | string | Channel Object |
filename | string | Name of the file |
contentType | string | Content 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 })
Parameter | Type | Description |
---|---|---|
collectionName | string | Either collectionName or dataSourceId. Collection name in the data source |
dataSourceId | string | Either collectionName or dataSourceId. Data source ID |
data | object | Data 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 })
Parameter | Type | Description |
---|---|---|
channel | object | Channel collection object |
member | object | Member collection object |
tagId | number | Tag ID |
Response
{
"errcode": number
"errmsg": string
}