How to change a value of next route?
RespondidaUsing ALE Rainbow chatbot library, i'm trying to change the value of next route in onMessage() callback.
Is-it possible to specify some additionals parameters in done() function to do that ?
Is there any oher documentation available more complete than this one: https://github.com/Rainbow-CPaaS/Rainbow-Chatbot
Thanks
-
Hmm, looking at the docs in GitHub: https://github.com/Rainbow-CPaaS/Rainbow-Chatbot
Will this resolve your question:
Rerouting
When you call the
done()function, you can pass a parameter corresponding to the name of the next action to execute. You scenario will be rerouted to this step and will continue.chatbot.onMessage((tag, step, content, from, done) => { if(step === "aStep" && content==="yes" && from.jid==="ajid@adomain.com") { done('special_step'); } else { done(); } }, this);
In that sample, depending on the step, the user and the answer received, a rerouting is done to the step
special_step. For other cases, the normal next step is executed.?
-
Ok
Problem here is, it uses internaly the Promise "resolve", why may only carry one argument.
But you can for example patch the code in Rainbow-Chatbot\index.js, line 172 and next to handle this inroutedStep- nothing,(resolve())
- or a "next step" (resolve("next step"))
- or an Array of ["next step", args] (resolve(["next step", args]) with args in json format) and store the args somewhere you need in
workBest regards,
Pascal
Iniciar sesión para dejar un comentario.
Comentarios
4 comentarios