chat-platform 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chat-platform.js +16 -4
- package/package.json +1 -1
package/chat-platform.js
CHANGED
|
@@ -215,7 +215,8 @@ const ChatExpress = function(options) {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
function inboundMessage(payload, chatServer) {
|
|
218
|
-
|
|
218
|
+
const options = chatServer.getOptions();
|
|
219
|
+
const contextProvider = options.contextProvider;
|
|
219
220
|
if (chatServer.isDebug()) {
|
|
220
221
|
// eslint-disable-next-line no-console
|
|
221
222
|
console.log(orange('-- INBOUND MESSAGE --'));
|
|
@@ -245,7 +246,8 @@ const ChatExpress = function(options) {
|
|
|
245
246
|
messageId: parsedMessage.messageId,
|
|
246
247
|
transport: parsedMessage.transport,
|
|
247
248
|
language: parsedMessage.language,
|
|
248
|
-
ts: parsedMessage.ts
|
|
249
|
+
ts: parsedMessage.ts,
|
|
250
|
+
chatbotId: options.chatbotId
|
|
249
251
|
}),
|
|
250
252
|
payload: {
|
|
251
253
|
type: parsedMessage.type,
|
|
@@ -259,7 +261,12 @@ const ChatExpress = function(options) {
|
|
|
259
261
|
return contextProvider.get(
|
|
260
262
|
parsedMessage.chatId,
|
|
261
263
|
parsedMessage.userId,
|
|
262
|
-
{
|
|
264
|
+
{
|
|
265
|
+
userId: this.originalMessage.userId,
|
|
266
|
+
transport: this.originalMessage.transport,
|
|
267
|
+
chatId: this.originalMessage.chatId,
|
|
268
|
+
chatbotId: this.originalMessage.chatbotId
|
|
269
|
+
}
|
|
263
270
|
);
|
|
264
271
|
},
|
|
265
272
|
api: function() {
|
|
@@ -282,7 +289,12 @@ const ChatExpress = function(options) {
|
|
|
282
289
|
.then(() => when(contextProvider.getOrCreate(
|
|
283
290
|
parsedMessage.chatId,
|
|
284
291
|
parsedMessage.userId,
|
|
285
|
-
{
|
|
292
|
+
{
|
|
293
|
+
userId: parsedMessage.userId,
|
|
294
|
+
transport: parsedMessage.transport,
|
|
295
|
+
chatId: parsedMessage.chatId,
|
|
296
|
+
chatbotId: options.chatbotId
|
|
297
|
+
}
|
|
286
298
|
)))
|
|
287
299
|
.then(chatContext => when(chatContext.set({ language: parsedMessage.language, authorized: false, pending: false })))
|
|
288
300
|
.then(function() {
|