Templates

ChatBot conversation flows

They are the building blocks of WCE. They define the brains, conversation flow which the bot respond to the user. Templates are predictable, are defined in "STAGES" or "STEPS" or "FLOW" whatever you want to call it, to make it easy to know where to go from 1 conversation to another based on user responses.

Template sources can be anything, yaml, json or database or anything.

By default the engine comes with YAML based templates support.

There are different message types in WhatsApp Message Types.

The engine supports a number of these official message types, as template kinds, with the common ones being:

  • text
  • button
  • list
  • flow
  • media

The engine can also handle dynamic and location message types

Examples

Consider an example template flow below

    "MAIN_MENU":
        kind: text
        message: "Hie there, type anything to start your booking journey"
        routes:
            "re:.*": "100"

    "100":
        kind: button
        message:
            body: "Hie there,\nStart your system demo booking request by clicking the start button"
            footer: ERP Demo
            buttons:
            - Start
            - Return
        routes:
            "start": "1000"
            "return": "MAIN_MENU"

    "1000":
        kind: button
        prop: erp_choice
        message:
            body: "Great choice, select your ERP of choice"
            buttons:
                - ERPNext
                - SAP
                - Odoo
        routes:
            "re:.*": "2000"

    "2000":
        kind: text
        prop: booking_date
        message: |
            Kindly provide your preferred demo date and time in 24hr format
            Format: _DD/MM/YYYY HH:MM_ e.g *23/05/2024 10:00*
        routes:
            "re://d{1,2}//d{2}//d{4}": "3000"

All templates have common fields with the exception of the message field which depends on the template kind or type.

We will cover all the different template fields in the next section.