Code-based Actions: Create quick replies in Cloud code actions

Quick replies are buttons that you can add to a reply to improve the customer experience. You can add quick replies in the flow section or within cloud code actions. This article will focus on adding quick replies using the code actions.

Quick replies in Cloud Code Actions

The following code is an example of a text with two Quick Reply buttons.

async payload => {

  const text = new Text('We have a 40" screen for sale. Want to preorder it?')  
  text.addQuickReply(new QuickReply({  
    label: 'πŸ‘',  
    value: 'Yes'  
  }))  
  text.addQuickReply(new QuickReply({  
    label: 'πŸ‘Ž',  
    value: 'No'  
  }))

  const message = new Message('Fallback text').addResponse(text)

  return message  
}