-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Make sure the issue is related to code located in this repository.
- I confirm that the reported bug or feature request is not related to Botpress on premise version (v12 and below)
- I confirm that the reported bug or feature request is not related to the Botpress Studio
- I confirm that the reported bug or feature request is not related to the Botpress Dashboard
Description of the bug or feature request
The card definition lists the subtitle field as optional, yet there is a runtime check that throws an InvalidDataFormat
error when subtitle is undefined.
From ./botpress/implementation/typings/channels/channel/messages/card.ts (auto built typings for WhatsApp):
export type Card = {
title: string;
subtitle?: string;
imageUrl?: string;
actions: Array<{
action: "postback" | "url" | "say";
label: string;
value: string;
}>;
};
Subtitle is listed as optional. Yet when I define a card in Botpress cloud like this:
workflow.my_card = {
title: "This is my card",
subtitle: undefined,
image_url: undefined,
buttons: [{label: "Button 1", action:"postback", value:"button 1"}]
}
Cloud throws this error:
Error sending outgoing message {
integration: 'webhook',
messageType: 'card',
payload: `{"type":"card","title":"This is my card","subtitle":"","actions":[{"label":"Button1","action":"postback","value":"button 1"}]}`,
error: Os [Error]: data/subtitle must NOT have fewer than 1 characters
at mB (/var/task/customer_code.js:14:18624)
at nt (/var/task/customer_code.js:14:18443)
at yB (/var/task/customer_code.js:14:19013)
at /var/task/customer_code.js:14:159026
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async flushSendMessages (/var/task/customer_code.js:3186:7901)
at async Promise.allSettled (index 48)
at async Object.flushSendMessages (/var/task/customer_code.js:3186:9647)
at async /var/task/customer_code.js:3373:2499 {
isApiError: true,
code: 400,
description: "The provided data doesn't respect the provided JSON schema.",
type: 'InvalidDataFormat',
error: undefined,
id: 'bb1770473af555e89c0db23bb166ae2f',
metadata: undefined
}
}
Tagging @SebastienPoitras since I know they're working on Whatsapp right now.
Metadata
Metadata
Assignees
Labels
No labels