Bot-building best practices

Ready to build your own bot on Chatlayer? Great choice! Here are some best practices for creating a great user experience.

Make it maintainable

  1. Reuse block as much as possible. Do not create similar blocks, but just reuse the same one in multiple flows. For example, if you have a block explaining what the bot can do for its users, you will probably show this a couple of times, like when the user asks 'how can you help me?' but also at the start of the conversation. Simply use the same block:

  • Next to reusing blocks, try to reuse information and variables as well. If you already asked the name of the user in the beginning of the conversation, this will be remembered throughout the entire conversation. If your bot would keep asking for the same information, it makes the bot look 'dumb'. Ask once, remember always.

  • Give clear titles to blocks, intents, and variables. This helps other people working on the bot to make quick changes.

Dynamic

Try to keep the bot as dynamic as possible, so it's resilient to change. For example, avoid hardcoding any information or variables in the bot but instead, pull needed information from an external database, to keep one source of truth. This way, whenever something changes in your organisation, you only need to change it in the database not in your blocks as well.

Edge cases

Make sure your bot can handle edge cases. If a user responds differently than expected, your bot should be able to handle this. Try to create a good 'not understood' message and test the bot thoroughly before publishing it, to include all use cases and questions a user might ask.

Flows

  • For Action blocks, try to limit API calls to less than 20 seconds to increase bot performance and prevent timeouts

  • In an Collect input block, always fill in the 'When user response is not valid the first 2 or 3 times, bot asks question' section. For example, if the input validation is expecting a date, but the user is not given a date as an answer, these error texts will be triggered. If they are empty, the bot will not give a response and the flow will simply stop.

If you have any other questions, do not hesitate to contact us, we're happy to help!

Last updated