Methods
这些是可以通过this
这个词访问的方法。你可以利用这些方法来执行不同类型的功能,如设置新的议程,发送电子邮件等。
例子:
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 | Node-fetch (this.fetch ) is a library for sending http(s) requests. |
moment | function | Moment (this.moment ) is a library for time related logic. Please note that this method only supports moment.js but not moment-timezone or luxon. |
lodash | function | Lodash is a utility library that improves QoL. |
Custom methods provided by Stella
DB Notes
Stella use mongoDB as database. For any DB methods below, please see the mongoDB CRUD Operations documentation for reference. More specifically, you should refer to the mongoDB's "Query Document" section for the filter
parameter. For the patch
and withModifier
parameters, you should refer to mongoDB's "Change a Document" section, where the patch
object will be set as $set
if withModifier
is false, while setting withModifier
to true will let you customize the update modifier, or to replace the document.
A findAndModify method is an atomic operation, ie. the "find" and "modify" happens at the same time. It is prefered to doing a "find" operation and a "modify" operation separately. It is used to prevent a critical action from happening more than once, even if the user spams the input or the external service sends multiple events at the same time, accidentally or purposefully. To achieve this, a filter
and patch
pair should be set so that the same entry won't be found after being modified. The example in findAndModifyMember shows how it works.
findAndModifyMember (Updated)
The method findAndModifyMember()
is used to find and modify a member.
Parameter
Name | Type | Description |
---|---|---|
filter | object | Filter to find the member |
patch | object | Object to be patched to the member |
withModifier | boolean | Default true. see DB Notes for more details |
sortBy | object | Optional. Order to sort the members. Note: only the first member after sorting is found and modified by this method. |
option | object | Optional. Use { "new": true } to get the modified member. Please refer to mongoDB's Collection Methods for other options. |
Example
this.findAndModifyMember({
filter: {
firstName: "John",
"meta.checked": false,
},
patch: {
"meta.checked": true,
},
withModifier: false,
sortBy: {
_id: -1,
},
option: {
new: true,
}
})
Response
Name | Type | Description |
---|---|---|
ok | number | 1 for successful call |
member | object | The Member object found. If option.new is true , the modified member will be returned. Otherwise, the original member will be returned. Return null if no matched member is found. |
{
ok: 1,
member: {
_id: "m12345678901234567890123",
app: "a12345678901234567890123",
channel: "c12345678901234567890123",
externalId: "1234567890",
firstName: "John",
lastName: "Doe",
botMeta: {
liveChat: false,
subscribe: true,
tempData: {},
nodeCompositeId: "abcdefghijklmnop",
tree: "t12345678901234567890123"
},
meta: {
checked: true,
},
platform: "custom",
tags: [],
createdAt: 1577808000000,
updatedAt: 1601481600000
}
}
findAndModifyDataFromDataSource (Updated)
The method findAndModifyDataFromDataSource()
is used to find and modify a data entry in a Data Source.
Parameter
Name | Type | Description |
---|---|---|
dataSourceId | string | Data Source ID |
filter | object | Filter to find the data entry |
patch | object | Object to be patched to the data entry |
withModifier | boolean | Default true. see DB Notes for more details |
sortBy | object | Optional. Order to sort the data entries. Note: only the first data entry after sorting is found and modified by this method. |
option | object | Optional. Use { "new": true } to get the modified data entry. Please refer to mongoDB's Collection Methods for other options. |
Example
this.findAndModifyDataFromDataSource({
dataSourceId: "a12345678901234567890123_coupon",
filter: {
location: "HK",
memberId: null,
},
patch: {
memberId: "m12345678901234567890123",
deliveredAt: 1601481600000,
},
withModifier: false,
sortBy: {
priority: 1,
},
option: {
new: true,
}
})
Response
Name | Type | Description |
---|---|---|
ok | number | 1 for successful call |
value | object | The data entry object found. If option.new is true , the modified data entry will be returned. Otherwise, the original data entry will be returned. Return null if no matched data entry is found. |
{
ok: 1,
value: {
_id: "d12345678901234567890123",
location: "HK",
couponCode: "1234",
priority: 0,
memberId: "m12345678901234567890123",
deliveredAt: 1601481600000,
createdAt: 1577808000000,
updatedAt: 1601481600000
}
}
upsertDataToDataSource (Updated)
The method upsertDataToDataSource()
will upsert data entries in the Data Source. If _id
exists in the data
object, it will be upserted in the Data Source, ie. if a data entry with the same _id
exists, the entry will be updated, else, a new data entry will be inserted. Otherwise, a new data entry will be inserted.
Parameter
Name | Type | Description |
---|---|---|
dataSourceId | string | Data Source ID |
data | object or [object] | Data to be updated or inserted |
Example
this.upsertDataToDataSource({
dataSourceId: "a12345678901234567890123_coupon",
data: [{
_id: "d12345678901234567890123", // exists in Data Source
location: "HK",
couponCode: "0123",
priority: 1,
}, {
_id: "d12345678901234567890124", // not exists in Data Source
location: "KLN",
couponCode: "0124",
priority: 2,
}, {
location: "NT",
couponCode: "0125",
priority: 3,
}]
})
Response
Name | Type | Description |
---|---|---|
result | object | Result object |
Result
Name | Type | Description |
---|---|---|
_docsIds | object | DocsIds object |
matched | number | Number of matched entries |
modified | number | Number of modified entries |
inserted | number | Number of inserted entries |
deleted | number | 0 |
DocsIds
Name | Type | Description |
---|---|---|
updated | [string] | Array of _id of updated entries |
inserted | [string] | Array of _id of inserted entries |
upserted | [string] | Array of _id of inserted entries with _id provided |
{
result: {
_docsIds: {
updated: ["d12345678901234567890123"],
inserted: ["d12345678901234567890125"],
upserted: ["d12345678901234567890124"]
},
matched: 1
modified: 1
inserted: 2
deleted: 0
}
}
newAgenda (Updated)
The method newAgenda()
can be used to create new agenda. Please refer here for reference on the Agenda system.
Parameter
Name | Type | Description |
---|---|---|
memberId | string | Stella Member ID |
treeId | string | Tree ID |
nodeCompositeId | string | Node Composite ID |
nextRunAt | number | Override pattern . Either nextRunAt or pattern is required. Timestamp for executing the agenda (Unix epoch time in milliseconds). The moment.js library can be used, eg. this.moment().add(5, "minutes").valueOf() gives the timestamp of 5 minutes from now. |
pattern | string | Either nextRunAt or pattern is required. CRON Pattern of the agenda. If you wish to check the CRON pattern, you can use Crontab Guru |
runUntil | number | Required if pattern is used. The agenda will be executed following the pattern until the runUntil timestamp. |
priority | number | Optional. The priority of the agenda. Agenda with the smaller priority number will be executed first. |
meta | object | Optional. The data associated with the agenda. This object can be accessed by this.agendaMeta when the agenda is executed. |
replace | boolean | Default false. Set as true to replace agendas of the same member with the same tag . |
tag | string | Required if replace is true . Agenda tag |
Example
this.newAgenda({
memberId: "m12345678901234567890123",
treeId: "t12345678901234567890123",
nodeCompositeId: "abcdefghijklmnop",
nextRunAt: 1609430400000,
priority: 1,
meta: {
testing: true
},
replace: true,
tag: "testing-agenda"
})
Response
The agenda object created will be returned.
{
_id: "ag2345678901234567890123",
app: "a12345678901234567890123",
channel: "c12345678901234567890123",
member: "m12345678901234567890123",
tree: "t12345678901234567890123",
nodeCompositeId: "abcdefghijklmnop",
nextRunAt: 1609430400000,
priority: 1,
meta: {
testing: true
},
tag: "testing-agenda",
completed: false,
}
redirectMemberToNode (Updated)
The method redirectMemberToNode()
is used to redirect a member to a node. The node will then be executed for the member according to the redirectOptions
. For usage in Stella API, you may also refer to the Stella API documentation.
Parameter
Name | Type | Description |
---|---|---|
memberId | string | Stella Member ID |
channelId | string | Channel ID of the Member |
treeId | string | Tree ID |
nodeCompositeId | string | Node composite ID |
redirectOptions | object | Optional. RedirectOptions Object |
meta | object | Optional. The data associated with the node. This object can be accessed by this.agendaMeta when the node is executed. |
RedirectOptions
Name | Type | Description |
---|---|---|
runPreAction | boolean | Default true. Whether the Pre Actions of the node is exectued. |
sendResponse | boolean | Default true. Whether the Responses of the node is sent. |
runPostAction | boolean | Default true. Whether the Post Actions of the node is exectued. |
Example
this.redirectMemberToNode({
memberId: "m12345678901234567890123",
channelId: "c12345678901234567890123",
treeId: "t12345678901234567890123",
nodeCompositeId: "abcdefghijklmnop",
redirectOptions: {
runPreAction: false,
sendResponse: true,
runPostAction: true
},
meta: {
testing: true
}
})
Response
Name | Type | Description |
---|---|---|
ok | number | 1 for successful call |
member | string | Stella Member ID |
sendResults | [object] | Array of NodeSendResult Object. The first entry represents the send results of the node. Any subsequence entries represent the send results of the nodes redirected from the original node. |
NodeSendResult
Name | Type | Description |
---|---|---|
ok | number | 1 for successful call |
member | string | Stella Member ID |
result | [object] | Array of SendResult Object. Each entry represents the send result of a response in the node. |
SendResult
Name | Type | Description |
---|---|---|
result | object | Platform specific result to the actual send request. The example below shows the result from Facebook. |
messageEvent | object | Message Event object. Please refer here for more details. |
chatId | string | Stella Chat ID |
{
ok: 1,
member: "m12345678901234567890123",
sendResults: [
{
ok: 1,
member: "m12345678901234567890123",
result: [
{
result: {
recipient_id: "1234567812345678",
message_id: "xxxxxxxxxxxxxxxx"
},
messageEvent: {
from: "8765432187654321",
to: "1234567812345678",
data: {
url: "https://s3.ap-southeast-1.amazonaws.com/radiate-admin/59bba4275a304100055da5bc/hello-min.gif",
attachment_id: "2345678923456789",
transform: ""
},
type: "IMAGE",
timestamp: 1604160000000,
messageId: "xxxxxxxxxxxxxxxx"
},
chatId: "ch2345678901234567890123"
},
{
result: {
recipient_id: "1234567812345678",
message_id: "xxxxxxxxxxxxxxxx"
},
messageEvent: {
from: "8765432187654321",
to: "1234567812345678",
data: {
text: "Hello, I am Stella the Dog 🐶 ",
transform: ""
},
type: "TEXT",
timestamp: 1604160000001,
messageId: "xxxxxxxxxxxxxxxx"
},
chatId: "ch2345678901234567890124"
},
{
result: {
recipient_id: "1234567812345678",
message_id: "xxxxxxxxxxxxxxxx"
},
messageEvent: {
from: "8765432187654321",
to: "1234567812345678",
data: {
transform: "",
quickReplies: [
{
content_type: "text",
title: "Yes ❤️",
payload: "ONBOARDING"
},
{
content_type: "text",
title: "No ☠️",
payload: "MAIN_MENU"
}
],
text: "My master Sanuker can help you make bots on different platforms with my help, would you like to make one?"
},
type: "QUICK_REPLIES",
timestamp: 1604160000002,
messageId: "xxxxxxxxxxxxxxxx"
},
chatId: "ch2345678901234567890125"
}
]
}
]
}
createAssignment (Updated)
The method createAssignment()
is used to request live chat for a member. The channel with the member requesting live chat is called the Inlet Channel. The Pairing Channels of the App are used to find the corresponding Outlet Channels for the Inlet Channel. The Broadcast Groups of the Outlet Channel are used with label
to determine the Targets the live chat request is sending to. There is different behaviour when the live chat request is sending to different platform. For platforms that do not utilize ticketing, such as Zendesk and Custom channels, the live chat request will be directly sent to the channel, and all other targets will be ignored. Otherwise, tickets will be sent to all Broadcast Groups in all Target Channels. Please refer to the documentation on the specific platforms for more details.
Parameter
Name | Type | Description |
---|---|---|
member | object | Member object. Use this.member for live chat request for the current member, or use the getMember method is get the member object for other member. |
assignmentDetails | object | AssignmentDetails Object |
label | string | Default "default" . Broadcast group label |
history | boolean | Default false. Whether the Stella conversation history url is attached to the live chat request. |
targets | [object] | Optional. Override label . Array of Target Objects. Will override the Pairing Channels and Broadcast Groups settings. |
meta | object | Optional. The data associated with the live chat request. This object can be accessed by the key meta in the assignment object of the live chat request. |
createGroup | object | For Custom channel only. CreateGroup object. |
setLiveChatAgenda | boolean | Default true. Whether the live chat agendas are created immediately. |
AssignmentDetails
Note: For a custom outlet channel, the whole AssignmentDetails
object will be sent to the Live Chat API. This field will become a blackbox and the below schema will be for reference only.
Name | Type | Description |
---|---|---|
summary | string | Optional. Summary of the live chat request. Will be sent to the live chat conversation in Outlet Channel when the conversation is created. |
groupName | string | Optional. Name of the live chat conversation created in Outlet Channel. |
relayMessage | object | Optional. The key of this object should be the name of the platform of the targets, ie. "slack" or "zendesk" . The value of this object is the relay message. For target that utilize ticketing, the relay message is the Response object of the ticket sent to the broadcast group. Otherwise, the relay message is the first message sent to the live chat conversation. |
Target
Name | Type | Description |
---|---|---|
channel | string | Stella Channel ID |
broadcastGroups | [object] | BroadcastGroup object |
label | string | Default "default" . Broadcast group label |
BroadcastGroup
Name | Type | Description |
---|---|---|
type | string | Type of the broadcast group. "zendesk" for Zendesk channel. "user" , "public_channel" or "private_channel" for Slack channel. |
id | string | Optional. External ID of the broadcast group. |
CreateGroup
Name | Type | Description |
---|---|---|
externalId | string | Optional. External ID of the live chat conversation. |
Example
Example 1: Create Slack live chat request. Tickets will be sent to broadcast groups with the label "test"
.
this.createAssignment({
member: this.member,
assignmentDetails: {
summary: `Name: ${this.member.firstName}\nSource: WhatsApp Live Chat`,
groupName: `${this.member.firstName}_liveChat_`.toLowerCase(),
relayMessage: {
slack: {
type: "BUTTON",
text: `Request Live Chat: ${this.member.firstName}`,
buttons: [{
type: "postback",
title: "待答覆",
payload: {
payload: "PICK_TICKET"
}
}]
}
}
},
label: "test",
history: true,
meta: {
testing: true
},
setLiveChatAgenda: true
})
Example 2: Create Slack live chat request. Tickets will be sent to the destinated target groups.
this.createAssignment({
member: this.member,
assignmentDetails: {
summary: `Name: ${this.member.firstName}\nSource: WhatsApp Live Chat`,
groupName: `${this.member.firstName}_liveChat_`.toLowerCase(),
relayMessage: {
slack: {
type: "BUTTON",
text: `Request Live Chat: ${this.member.firstName}`,
buttons: [{
type: "postback",
title: "待答覆",
payload: {
payload: "PICK_TICKET"
}
}]
}
}
},
history: true,
targets: [
{
channel: "c12345678901234567890123",
broadcastGroups: [
{
type: "public_channel",
id: "C1234123412"
},
{
type: "private_channel",
id: "G1234123413"
}
]
},
{
channel: "c12345678901234567890124",
broadcastGroups: [
{
type: "user",
id: "U1234123414"
},
{
type: "user",
id: "U1234123415"
}
]
}
],
meta: {
testing: true
},
setLiveChatAgenda: true
})
Example 3: Create Zendesk live chat request. A new ticket will be created in the Zendesk platform.
this.createAssignment({
member: this.member,
assignmentDetails: {
relayMessage: {
zendesk: {
type: "TEXT",
text: `${this.member.firstName} - Enquiry from WhatsApp`,
}
}
},
label: "test-zendesk"
})
Example 4: Create live chat request on Custom channel. A POST request will be sent to the Live Chat API of the channel.
this.createAssignment({
member: this.member,
assignmentDetails: {
summary: `Name: ${this.member.firstName}\nSource: WhatsApp Live Chat`,
groupName: `${this.member.firstName}_liveChat_`.toLowerCase(),
},
label: "test-custom",
history: true,
createGroup: {}
})
Response
Name | Type | Description |
---|---|---|
member | object | Member object |
assignmentId | string | Stella ID of the assignment created |
groupId | string | Applied only when createGroup is set. Stella ID of the group created |
{
member: {
_id: "m12345678901234567890123",
app: "a12345678901234567890123",
channel: "c12345678901234567890123",
externalId: "1234567890",
firstName: "John",
lastName: "Doe",
botMeta: {
liveChat: true,
subscribe: true,
tempData: {},
nodeCompositeId: "abcdefghijklmnop",
tree: "t12345678901234567890123"
},
platform: "custom",
tags: [],
createdAt: 1577808000000,
updatedAt: 1601481600000
},
assignmentId: "as2345678901234567890123",
groupId: "g12345678901234567890123"
}
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
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({ memberId: string, tag: 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
},
// ...
]
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 providing the meta object.
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
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. WhatsApp 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 }>
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 responses to the member in 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 responses 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 responses 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. If you wish to check the CRON pattern, you can use Crontab Guru |
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 |
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 WeChat 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
}