Newer Version Available

This content describes an older version of this product. View Latest

Custom Pre-Chat Component Sample Using Aura

The following code sample contains examples of the component, controller, and helper code for a custom pre-chat component using Aura.

This component:

  • Uses Aura to create the pre-chat fields and start a chat.
  • Uses an initialize function that fetches the pre-chat fields from setup and dynamically creates the pre-chat field components using $A.createComponents.
  • Creates an array when the user clicks the Start Chat button. The array contains pre-chat field information to pass to the startChat method on the prechatAPI component.

Component Code

Controller Code

Helper Code