Introduction

This package creates a preconfigured conversational bot to demonstrate formatting and validation in prompts.

Installing the package

Navigate to Setup » Packages » Import.

Paste the following package into the large text box:



{
  "package": {
    "name": "Prompt Bot",
    "revision": 1,
    "requires": {
      "cerb_version": "8.3.4",
      "plugins": []
    },
    "configure": {
      "prompts": [],
      "placeholders": []
    }
  },
  "bots": [
    {
      "uid": "bot_prompt_",
      "name": "Prompt Bot",
      "owner": {
        "context": "cerberusweb.contexts.app",
        "id": 0
      },
      "is_disabled": false,
      "params": {
        "config": null,
        "events": {
          "mode": "all",
          "items": [

          ]
        },
        "actions": {
          "mode": "all",
          "items": [

          ]
        }
      },
      "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAnFBMVEUAfL3///8Ce7wIfr7///L///cFfLoJfLcPfrb2//////vv8+7f6OO90tcLfroagbUjhLTf8/u73fCtyc9Xo82DscEehr5dnbk/kLUvibXM6Pen0uyayeV8uNtlqtSewMqPuMczkMMqjMF2qsBpo70TgrxSmLlIk7XQ6PfU6OSIwODQ3d7C3d7N3dpusdVMnck6k8UYg71Ik7c3jLWea0S3AAABKklEQVRo3u3YSVLDQAyFYUngIU5iDIkJJEAG5nm6/90oKou3AO30Fq7Sd4G/Ene71ZaUUkoppZTSH/bSCd2BanFvwoHIr74SBkT2pkcCjMje+EwgPALXpUB0BKa1QHQExt/ECDQ3JTECs5oYgck5MQLNwiSIHatvXUuQ8kp9k06inJ6oq7iL+9fmI3VtKolye6Gu17jXp314qyD20Gkv1dVLnN2D92NMApVvCnCICGFREyJY1MQItCt+xLZLYgR7kxqx9xH7wX+u2EvY5uoojP/SbxaE44ty5u+W6prVpLcvxMxhW+cciZvD2yd1hN0obKS+vmIPd8WXsSfI544+pq4r4sCNIZgWwdYmRPytPcyL6f9be2gfCzbkzx64gfDYYycppZRSSmlAfgBgHg39/R/GDgAAAABJRU5ErkJggg==",
      "behaviors": [
        {
          "uid": "behavior_convo_demo",
          "title": "Convo: Demonstrate prompts",
          "is_disabled": false,
          "is_private": false,
          "priority": 50,
          "event": {
            "key": "event.message.chat.worker",
            "label": "Conversation with worker"
          },
          "nodes": [
            {
              "type": "action",
              "title": "Hi!",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "Hi, {{worker_first_name}}!",
                    "format": "",
                    "delay_ms": "1000"
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Prompt for text",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "Enter some text:",
                    "format": "",
                    "delay_ms": "1000"
                  },
                  {
                    "action": "prompt_text",
                    "placeholder": "(type anything)",
                    "default": "I'm not feeling very creative today.",
                    "mode": "",
                    "var": "prompt_text",
                    "var_format": "{{message}}",
                    "var_validate": "{% if prompt_text is empty %}\r\nC'mon! You can at least type _something_!\r\n{% endif %}"
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Prompt for number",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "Pick a number between 1 and 100",
                    "format": "",
                    "delay_ms": "1000"
                  },
                  {
                    "action": "prompt_text",
                    "placeholder": "(enter a number between 1 and 100)",
                    "default": "",
                    "mode": "",
                    "var": "prompt_number",
                    "var_format": "{{message|replace({',':''})|number_format(0, '.', '')}}",
                    "var_validate": "{% if message is not numeric %}\r\nPlease enter a valid number.\r\n{% elseif prompt_number < 1 or prompt_number > 100 %}\r\nThe number must be between 1 and 100.\r\n{% endif %}"
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Prompt for date",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "Please enter a date",
                    "format": "",
                    "delay_ms": "1000"
                  },
                  {
                    "action": "prompt_date",
                    "placeholder": "(enter any future date; e.g. \"tomorrow 8am\")",
                    "default": "",
                    "mode": "",
                    "var": "prompt_date",
                    "var_format": "{{message|date('U')}}",
                    "var_validate": "{% if 0 == prompt_date %}\r\nPlease enter a valid date. For instance, \"Friday noon\".\r\n{% elseif prompt_date < 'now'|date('U') %}\r\nPlease enter a date in the future.\r\n{% endif %}"
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Prompt for email",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "What's your email address?",
                    "format": "",
                    "delay_ms": "1000"
                  },
                  {
                    "action": "prompt_text",
                    "placeholder": "(you@example.com)",
                    "default": "{{worker_address_address}}",
                    "mode": "",
                    "var": "prompt_email",
                    "var_format": "{{message|parse_emails|first.email}}",
                    "var_validate": "{% set email = message|parse_emails|first %}\r\n{% if prompt_email is empty %}\r\nPlease enter a valid email address.\r\n{% elseif email.host == 'localhost' %}\r\nPlease enter a valid email address.\r\n{% endif %}"
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Prompt for yes/no",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "Yes or no?",
                    "format": "",
                    "delay_ms": "1000"
                  },
                  {
                    "action": "prompt_buttons",
                    "options": "yes\r\nno",
                    "color_from": "#57970a",
                    "color_mid": "#4795f7",
                    "color_to": "#cf2c1d",
                    "style": "display:inline;width:100px;",
                    "var": "prompt_yesno",
                    "var_format": "{{'yes' == message ? 1 : 0}}",
                    "var_validate": ""
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Prompt with chooser",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "Choose a worker:",
                    "format": "",
                    "delay_ms": "1000"
                  },
                  {
                    "action": "prompt_chooser",
                    "context": "cerberusweb.contexts.worker",
                    "query": "isDisabled:n",
                    "selection": "single",
                    "autocomplete": "1",
                    "var": "prompt_worker_id"
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Prompt with images",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "How do you prefer to be notified?",
                    "format": "",
                    "delay_ms": "1000"
                  },
                  {
                    "action": "prompt_images",
                    "images": [
                      "data:image/png;base64,iVBORw0KGgoAAAAN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/rx+c371+ePkdfv35w9MWLEiBEjRv+XMWLEiP+PX/O9XNHni45PAAAAAElFTkSuQmCC",
                      "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAB+1BMVEX+rwPgAADjAADfAACrSgG7AAD+rgPoAAD9rATjGBjBAAD+rAfaAAC+AADhBgThCAfgAwPDAADuZDrTAADOAADIAAD8qwPymAO/BQDdAADlIBj6mgziDQv3pAPkAADXAADVAADzdRv1gxX2iBP4kBD8owj8pgf6qgP+pwP1oQPznAPsmgPrjgLagwLnfgLcbwLSUwHNRQHKNgHDIwHBGQC/EgDACQDcAADFAADoOTXtUyDqPx/wYhzoMhzmKRrsSRn0exfiERD7oAz5lAv4qAP5pgPpkALqjALmhQLfcQLYYQLGLAGpGgDADQCjBQDLAACxAADmMzL2jTDlLS3mKCHpNx7vWx3yahrlGxnuVhjjFBTjEw39qQvhCgrulQPhewLWZALHXAK/WgHHNwHDKQG9IwHAHgDRFACnEACqAwDMAAC6AADsV0rzgEXqTEHwZTvtWzbvajXsYjT1iDH0hC7sUC3rSiX2jiTqRyP5myL4lh/xZx/2iR7nbB3ybRz5ohvqPBrtMxn4kxTPJhLkGRLQEhLvWhDkGhDAFgryaQfmMgX5oQPunQPvkgP4jQPObAP3kQLijQLyiwLehwLjcQLQXwKwTwLqAgLRVwG6UgHaUQG6TgHkSAHNSAGyQwHjPAG4NwG0MwG4KAGqKAGgFQDHEwC7CADJAwDQAACt3LItAAAC4ElEQVRo3u3aV1PbQBSG4WMp2cjCMnZsXGJsjME2YGzTMT300HsCBBIgdNJ777333vvPTGZCIu1qJrk5e5FBzx/4rt45kkZgMBj+Ii8PDIa1grTNrNN7eq8AELme9PYr63Uu5QAiKSk7n23QudAMiEiiwi6YWNbzPtSRwnLZpJPeEAZM7nlFFHQjYxHAVDCrVOpGMmslwJS/S7HoRrZnE8DkL1aCupFrmwFVa5HiZEfETTmAKtqp9OlG6nMBlavDk8GO2Op8gEpK9KRM7EhNE6Ai7WV2XfANEcB1p1T2si1ulQCXu0tmQ8ncRgBXQYmcJbAtArL8YtlBj4iXQ4DMXySzNaotYmnp9CwzI/XNgMzVUZFhotU1ATKSKGdHasKAbUtZSqSDr5YAW2Gp3StQLdYSwLajy07XmHkW0LmZGsVG9WRxq1E0q5kg3kbPd4FqMRfQuTornCatYR+gI8mePmpkJAL4dtI12o6rmWDWmKGt0VpNAF97aUp7GydPgQq1Rm2L1MnCvI2aTMZDwIG/WA5qW8wFDqJFHoe2RR9wQKaoGuvCwEOyZ1n7+Ehlgl8jmwlyjdrHR+CicN7u1Tw+AhfuWbkS/2Tp3xvV5M0h4CL6RsliThY+8tyjHuB6H/Ax9dUpiKtGwsBH8vqVUfOqoxHgw33m4L6Nvxw4LQEfREr7TZLA8G8tsUfx+IPbUeDHH3/1qXtxsfvDdJsLOIm9+LykOINZjj7PXAenldjb3hVLIBAQAgFT8Mtj4ME/07v+zydCwbvwEDiId/dr34Iq33FIpWV6if5qa70L6GLv+x30yA1A1/ZxxUKPXAV07XPMR1vbGKjwXrEtzCs2oHOXpOiRxmxA1/ryW1C7IQ5fBHQkseAQNRuT+ycA363XFq+6Yas6CRyQ+zfTrasTonXgcBrwQJobRsfTfy6INvPewTTgRAodqRoYGqraveccAY6ajh0aPDEBBsPaZPyXYfg//QDqa2qZimyTPAAAAABJRU5ErkJggg==",
                      ""
                    ],
                    "labels": [
                      "mobile",
                      "email",
                      "notification",
                      ""
                    ],
                    "var": "prompt_notify",
                    "var_format": "{{message|lower}}",
                    "var_validate": ""
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Prompt with file upload",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "Send me an image file smaller than 250KB.",
                    "format": "",
                    "delay_ms": "1000"
                  },
                  {
                    "action": "prompt_file",
                    "var": "prompt_file_id",
                    "var_format": "{{message|number_format(0)}}",
                    "var_validate": "{% if prompt_file_size > 250000 %}\r\nThe file must be smaller than 250KB.\r\n{% elseif not (prompt_file_mime_type starts with 'image/') %}\r\nPlease send an image file: PNG, JPEG, GIF.\r\n{% endif %}"
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Prompt with wait",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "{% set r = [\r\n\"Ok! Let's recap...\",\r\n\"Checking my notes...\",\r\n\"Let's see...\",\r\n] %}\r\n{{random(r)}}",
                    "format": "",
                    "delay_ms": "1000"
                  },
                  {
                    "action": "prompt_wait"
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Respond with summary",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "send_message",
                    "message": "You said:\r\n\r\n* Text: {{prompt_text}}\r\n* Number: {{prompt_number|number_format(0, '.', ',')}}\r\n* Date: {{prompt_date|date('F d, Y g:ia')}}\r\n* Email: {{prompt_email}}\r\n* Yes/No: {{prompt_yesno ? 'yes' : 'no'}}\r\n* Worker: {{prompt_worker__label}} (#{{prompt_worker_id}})\r\n* Notify: {{prompt_notify}}\r\n* File: {{prompt_file__label}} (#{{prompt_file_id}})\r\n",
                    "format": "markdown",
                    "delay_ms": "1000"
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Bye!",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "prompt_buttons",
                    "options": "Bye!",
                    "color_from": "#4795f7",
                    "color_mid": "#4795f7",
                    "color_to": "#4795f7",
                    "style": "",
                    "var": "",
                    "var_format": "",
                    "var_validate": ""
                  }
                ]
              }
            },
            {
              "type": "action",
              "title": "Close chat",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "window_close"
                  }
                ]
              }
            }
          ]
        },
        {
          "uid": "behavior_get_interactions",
          "title": "Get interactions for worker",
          "is_disabled": false,
          "is_private": false,
          "priority": 50,
          "event": {
            "key": "event.interactions.get.worker",
            "label": "Conversation get interactions for worker",
            "params": {
              "listen_points": "global\r\n"
            }
          },
          "nodes": [
            {
              "type": "switch",
              "title": "Point:",
              "status": "live",
              "nodes": [
                {
                  "type": "outcome",
                  "title": "global",
                  "status": "live",
                  "params": {
                    "groups": [
                      {
                        "any": 0,
                        "conditions": [
                          {
                            "condition": "point",
                            "oper": "is",
                            "value": "global"
                          }
                        ]
                      }
                    ]
                  },
                  "nodes": [
                    {
                      "type": "action",
                      "title": "Return interaction",
                      "status": "live",
                      "params": {
                        "actions": [
                          {
                            "action": "return_interaction",
                            "behavior_id": "{{{uid.behavior_handle_interaction}}}",
                            "name": "Demonstrate prompts",
                            "interaction": "prompts.test",
                            "interaction_params_json": ""
                          }
                        ]
                      }
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "uid": "behavior_handle_interaction",
          "title": "Handle interaction with worker",
          "is_disabled": false,
          "is_private": false,
          "priority": 50,
          "event": {
            "key": "event.interaction.chat.worker",
            "label": "Conversation handle interaction with worker"
          },
          "nodes": [
            {
              "type": "switch",
              "title": "Interaction:",
              "status": "live",
              "nodes": [
                {
                  "type": "outcome",
                  "title": "prompts.test",
                  "status": "live",
                  "params": {
                    "groups": [
                      {
                        "any": 0,
                        "conditions": [
                          {
                            "condition": "interaction",
                            "oper": "is",
                            "value": "prompts.test"
                          }
                        ]
                      }
                    ]
                  },
                  "nodes": [
                    {
                      "type": "action",
                      "title": "Start convo",
                      "status": "live",
                      "params": {
                        "actions": [
                          {
                            "action": "switch_behavior",
                            "return": "0",
                            "behavior_id": "{{{uid.behavior_convo_demo}}}",
                            "var": "_behavior"
                          }
                        ]
                      }
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}


Click the Import button.

You should see the following result:

Running the interaction

Prompt Bot is now available from the global interaction menu in the lower right.

  1. Click on the floating Cerb icon in the lower right. (Refresh the page if you don’t see it)

  2. Expand Prompt Bot.

  3. Select the Demonstrate prompts interaction.

The bot will begin to demonstrate prompts.

Prompt for text

The first prompt asks you to Enter some text:.

Try responding with a blank answer.

Aside from that, you can type anything to continue.

Prompt for number

You’ll be prompted to Pick a number between 1 and 100.

Try entering some numbers outside of that range, or even some non-numbers.

Enter a number between 1 and 100 to continue.

Prompt for date

You’ll be prompted with Please enter a date.

You can type an absolute date (2018-06-15 08:00) or a relative one (tomorrow 8am).

Try entering a date in the past (yesterday noon).

Enter a future date to continue.

Prompt for email address

You’ll be asked What’s your email address?.

Try entering a blank answer, or a phrase that doesn’t match the format of an email address.

Enter a valid email address to continue.

Prompt with buttons

You’ll be prompted Yes or no?.

You can’t really mess this one up.

Select Yes or No to continue.

Prompt with chooser

You’ll be prompted Chooser a worker:.

Select a worker to continue.

Prompt with images

You’ll be asked How do you prefer to be notified?.

Select the image for mobile, email, or notification to continue.

Prompt with file upload

You’ll be asked Send me an image file smaller than 250KB.

Upload an image smaller than 250KB to continue.

Summary

At the end of the prompts, you’ll be shown a summary of your selections.

This demonstrates how the bot can remember your answers for later use.

How it works

In Search » Bots, open the card for Prompt Bot.

Click the Behaviors button and open the card for Convo: Demonstrate Prompts.

Click on Prompt for number and select Edit from the menu.

Read our guide about prompts in conversational bots.