wingbot 3.76.4-alpha.14 → 3.76.4-alpha.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.76.4-alpha.14",
3
+ "version": "3.76.4-alpha.15",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -16,13 +16,19 @@ function extractText (payload) {
16
16
  return payload.message.text;
17
17
  }
18
18
 
19
- // button message
20
- if (payload.message && payload.message.attachment
21
- && payload.message.attachment.type === 'template'
22
- && payload.message.attachment.payload
23
- && payload.message.attachment.payload.text) {
24
-
25
- return payload.message.attachment.payload.text;
19
+ // button message — the orchestrator normalizes a singular `attachment` into
20
+ // a plural `attachments` array before persisting, so accept both shapes;
21
+ // otherwise template messages (e.g. button templates) logged via the
22
+ // orchestrator drop out of the transcript entirely.
23
+ const attachment = payload.message
24
+ && (payload.message.attachment
25
+ || (Array.isArray(payload.message.attachments) && payload.message.attachments[0]));
26
+ if (attachment
27
+ && attachment.type === 'template'
28
+ && attachment.payload
29
+ && attachment.payload.text) {
30
+
31
+ return attachment.payload.text;
26
32
  }
27
33
 
28
34
  if (!payload.postback) {