FlowMap, each state may also specify certain options. Some options expose built-in Xip functionality, while others are completely custom and can be referenced by your code.
fails_tooption is one of the built-in Xip state options. By default, it's used in the
CatchAllsControllerto specify where a user should be sent in the event of an error. We cover this more in the CatchAll docs, but in the
get_hello_responsestate above, if Xip encounters an error the
fails_tooption declares the user to be sent to the
say_hellostate of the same flow.
fails_tovalue can also be a string if you wish to specify a different flow. So for example:
say_goodbyestate of the
redirects_tooption is useful when you're performing a rename of a state and the bot has already been deployed to production. Your production users may have existing sessions attached to the state you are renaming. If you were to perform a state rename without attaching a
redirects_toto the old state name, the user will receive an error the next time they message your bot.
FlowMapabove, we've defined a
re_engageoption on the
say_goodbyestate. If we pretend our bot re-engages leads after a period of time, this option would be useful for allowing us to declare states for which we do not want re-engagements to be sent. In this case, the user has reached the end of the bot and so we don't want to send them any re-engagements.
optsattribute for the state specification.
state_spec.opts[:re_engage]contains the value
true. The hash key will correspond to what you named your option in the