Skip to content

Commit

Permalink
fix: Added missing footer and title option for WPP.chat.sendListMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Apr 29, 2022
1 parent e4d4403 commit 19401b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/chat/functions/sendListMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { sendRawMessage } from '.';
export interface ListMessageOptions extends SendMessageOptions {
buttonText: string;
description: string;
title?: string;
footer?: string;
sections: Array<{
title: string;
rows: Array<{
Expand All @@ -45,8 +47,10 @@ export interface ListMessageOptions extends SendMessageOptions {
* @example
* ```javascript
* WPP.chat.sendListMessage('[number]@c.us', {
* buttonText: 'Click Me!',
* description: "Hello it's list message",
* buttonText: 'Click Me!', //required
* description: "Hello it's list message", //required
* title: 'Hello user', //optional
* footer: 'Click and choose one', //optional
* sections: [{
* title: 'Section 1',
* rows: [{
Expand Down Expand Up @@ -87,14 +91,17 @@ export async function sendListMessage(

const list: RawMessage['list'] = {
buttonText: options.buttonText,
description: options.description,
description: options.description || ' ',
title: options.title,
footerText: options.footer,
listType: 1,
sections,
};

const message: RawMessage = {
type: 'list',
list,
footer: options.footer,
};

return await sendRawMessage(chatId, message, options);
Expand Down
2 changes: 2 additions & 0 deletions src/whatsapp/models/MsgModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ interface Props {
list?: {
buttonText: string;
description: string;
footerText?: string;
title?: string;
sections: Array<{
title: string;
rows: Array<{
Expand Down

0 comments on commit 19401b3

Please sign in to comment.