diff --git a/README.md b/README.md index ddceac0..846666d 100644 --- a/README.md +++ b/README.md @@ -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', diff --git a/index.js b/index.js index 0a5d5cc..ce751da 100644 --- a/index.js +++ b/index.js @@ -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) @@ -433,7 +437,7 @@ class WhatsappCloud { text: footerText, }, action: { - button: 'Select a product', + button: actionName, sections: validSections, }, },