Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #14 fix #17

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ await Whatsapp.sendRadioButtons({
bodyText:
'Daggie has some great products lined up for you based on your previous shopping history.\nPlease select one of the products below.',
footerText: 'Approved by Daggie Blanqx',
actionName: 'Select a product', // if not provided, default value will be 'Select a product'
listOfSections: [
{
title: 'Top 3 Fashion',
Expand Down
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,13 @@ class WhatsappCloud {
bodyText,
footerText,
listOfSections,
actionName
}) {
this._mustHaverecipientPhone(recipientPhone);

if(!actionName)
actionName = "Select a product"; //Default value
if (actionName.length > 20)
throw new Error('Action name should be less than 20 characters');
if (!bodyText)
throw new Error('"bodyText" is required in making a request');
if (!headerText)
Expand Down Expand Up @@ -433,7 +437,7 @@ class WhatsappCloud {
text: footerText,
},
action: {
button: 'Select a product',
button: actionName,
sections: validSections,
},
},
Expand Down