Skip to content

Commit

Permalink
Merge pull request #27 from Cognigy/feature/tyntec-whatsapp-trigger-i…
Browse files Browse the repository at this point in the history
…ntent

added trigger intent to quick reply transformer
  • Loading branch information
alexteusz authored Jun 29, 2021
2 parents 8dee9b8 + 76c9121 commit b1a295d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion endpoint/rest/whatsapp/transformer-v4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ type TWhatsAppContent = IWhatsAppTextMessage | IWhatsAppMediaMessage | IWhatsApp
interface IDefaultQuickReply {
title: string;
payload: string;
contentType: string;
}

interface ISessionStorageQuickReply {
Expand Down Expand Up @@ -355,7 +356,11 @@ createRestTransformer({
for (let sessionQuickReply of sessionQuickReplies) {
// the user can send the number or the title of a quick reply
if (text.toLowerCase().includes(sessionQuickReply.index) || text.toLowerCase().includes(sessionQuickReply.quickReply.title.toLowerCase())) {
text = sessionQuickReply.quickReply.payload;
if (sessionQuickReply.quickReply.contentType === "trigger_intent") {
text = sessionQuickReply.quickReply.title;
} else {
text = sessionQuickReply.quickReply.payload;
}
}
}

Expand Down

0 comments on commit b1a295d

Please sign in to comment.