Managing Errors
In a perfect world, your flows would never encounter an error and every one of your conversations would work perfectly without a hitch. In reality, however, it is inevitable that at some point your flows will experience some failures.
This most common types of failures are users blocking your bot (bounces), authorization problems with your platform of choice or one of your integrations, and attempting to send messages to users in one flow while waiting for them to answer a question in another flow (conflicts).
Flow XO offers a variety of different ways to discover what errors are happening in your flows and to deal with them as gracefully as possible. This article will cover the following error-related topics:
- Getting Notified - how to configure Flow XO to send you or your users a message when errors occur
- Reviewing Historical Errors - where to go to easily see what errors have occurred in your account recently
- Handling Errors - respond to errors in realtime with a special trigger that will fire whenever an error occurs, allowing you to create custom logic to manage your errors. Use this to send your users specialized error messages, keep analytics systems updated via webhooks, or anything else a flow can do.
- Dealing with Conflicts - getting the dreaded "The question could not be asked because another question was waiting to be answered?" error? We have some specialized tools to deal with this situation gracefully, depending on your use case.
Getting Notified
When an error occurs in your flows, it often means that one of your users had a conversation prematurely interrupted, or that one of your back end systems was not updated properly, or some other undesirable outcome that you will want to address as quickly as possible, rather than waiting for your users to inform you (which they may not do for a long time) or for you to notice your back end systems aren't updating the way you expect.
To ensure that you (or your users) are informed when things go wrong, you can configure how Flow XO sends error notifications in your User Profile.
In the Error Handling section of your User Profile, you can configure if you want to be e-mailed when errors occur, and if so how frequently. You can also configure whether or not you want a message automatically sent to your users when an error occurs in a chatbot flow, and what the error message should be.
When configuring your e-mail settings, you can choose to be notified:
Never - Flow XO will not send you e-mails when an error occurs.
Every Time - Flow XO will e-mail you every single error. Use this setting with caution - if you send a broadcast to a large audience, you are likely to receive a number of conflicts or other errors - you could end up flooding your e-mai!
No more frequently than once per [time period] - Flow XO will send an e-mail when an error occurs, but then wait for the specified period of time before sending another one. This is usually your best bet, so that you can be notified in a timely manner when things go wrong, but are protected from a flood of error e-mails if something goes really wrong. If you are concerned that this setting will cause you to miss out on certain errors, you can always review your error dashboard (see below) to check on the most recent errors all in one place.
The error e-mails you receive will be from Flow XO Support and have [Flow XO Alert] in the subject. Here's an example:
User Notifications
By default, when an error occurs in a chatbot flow, the bot simply stops. It does not tell the user that an error occurred. If you would like to *always* send a message to a user when an error occurs, you can set 'When a flow fails, notify the user that an error occurred' to Yes, and configure an error message.
Note that this setting will always send your users the same message no matter what flow fails in what way. This may be just what you need, but you can also use an 'Error Handling Flow' (described later in this article) to provide a more custom response to your users in different situations.
Reviewing Historical Errors
Although getting notified when errors happen is very useful, you also need to be able to review your historical errors to see where your flows may be encountering issues on a regular basis. In Flow XO, there are two places you can go to review errors:
The Interaction Log displays ever interaction across all flows. If a flow failed, it will have a 'Failed' status in the interaction log. Navigating to the interaction details will show you on what step the flow failed, and what the error message was:
The Error Log is a history of your recent errors, with filters to allow you to filter on the error message, error type, failing workflow, etc.
Handling Errors (Error Flows)
There may be times where you need some custom behavior when an error occurs. Use cases include sending your users a specialized error message when a flow fails in a certain way or updating an analytics system via an HTTP REST call when a user bounces because they blocked your bot.
In order to facilitate this kind of customization, we have added a 'New Error' trigger to the Flow XO Utils service, which can be found under 'Other Services' when creating a trigger:
You can create as many error handling flows as you want using the New Error trigger, and Flow XO will fire each one for every error (unless the trigger is filtered out).
You can use Filters on the trigger to handle only specific errors, or specific types of errors, or errors from a specific task or a specific workflow. The fields available for filtering are described in detail here.
NOTE: The full range of functionality available in normal flows are available in error handling flows (which are just normal flows). This means that you can send the end user a message, a card, or any other kind of message. Be aware, however, that if you have Notify End User when an Error Occurs selected in the Error Handling section of your user profile (see above), Flow XO will also send THAT message to your user. So they could get multiple messages. If you plan to send users messages as part of your Error Handling flows, you should turn the setting in your profile OFF and rely only on the error handling flows to communicate error messages to your users.
Handling Abandoned Conversations
You can also create "abandoned conversation" handling flows, exactly like error handling flows. Please see this article for more information: https://support.flowxo.com/article/162-ask-a-question#invalid_answer
Dealing with Conflicts
One of the things new and veteran Flow XO users alike struggle with when using multiple unique flows to implement a single conversational agent, is dealing with the situation where a bot is waiting on a user to respond to a question. When the bot is paused because an Ask a Question task or a Await Response task were used, no other messages can be sent to the user by default.
This restriction is to prevent confusing the user with multiple questions or messages and preventing the user from understanding how to respond to the bot to advance the workflow.
There are times, however, where the bot maintainer legitimately needs to communicate with these users anyway. These use cases fall into two main groups:
- You want to send your users a broadcast, but cannot reach all of your users because some are waiting for a question to be answered. Because your broadcast takes priority over any prior question, you want to be able to cancel any previous questions and start a new conversation using the broadcast.
- You want to remind your users to take action, and the built in reminder options in Ask a Question are not sufficient. Perhaps you chose to make a question never expire, or gave the question a very long expiry time, and need to send users a message encouraging them to complete the conversation.
Both of these use cases now have solutions.
Canceling Open Questions
For the first use case, you want to cancel any open questions your users may have pending in order to send a higher priority message via a broadcast. Although this feature can be used outside of a broadcast as well, it will generally be most useful in a broadcast scenario. To accomplish this, add a Users - Clear Open Questions task from the Flow XO Utils package as the very first step in your broadcast flow, as seen here:
Sending Messages WITHOUT Cancelling Open Questions
Occasionally you might need to send a message to a user without canceling an open question. Generally speaking, this should only be done to remind the user to answer the question, or to provide some kind of urgent update, because if it draws the users attention away from the question you are waiting on them to answer it will make it less likely that they answer the question properly, and more likely that they will become confused when they interact with your bot and the bot interpreted their interaction as a response to the question.
Even so, the capability now exists to send messages, cards, images, and custom requests to a user without canceling open questions and without encountering an error. Note that it is NOT possible to use an Ask a Question task in this way. To ask the user another question you must cancel any open questions first.
In the advanced settings of each messaging task other than Ask a Question you will find this setting:
Expand 'Change unanswered question behavior' and select 'Yes' for the 'Bypass unanswered questions':