Comments (4)
Hi @luizcarvalho,
Can you elaborate a little on your use-case? We've built a few bots now and haven't needed a full blown routes system. For the most part, all of our route
methods in BotController
look like this:
def route
if current_message.payload.present?
handle_payloads
current_message.payload = nil
return
end
if current_session.present?
step_to session: current_session
else
step_to flow: 'hello', state: 'say_hello'
end
end
handle_payloads
is a method with a case statement to handle Facebook button payloads.
from stealth.
I understood. I'll wait for a demonstration of use to be more clear how your use this.
Thank very much my friend. :D
from stealth.
Nicee, this is works to most of my problems haha, thanks. I not found this in docs.
But, when user send a random text message? I'll need use NLP?
from stealth.
I should add an example of handle_payloads
to the stealth-facebook
gem. It's pretty Facebook specific though as other message platforms often don't have the same concept of a "payload". I think it'll be helpful for everyone, though.
Basically that route
method comes with BotController
and is required to be there. By default, users are sent to hello->say_hello
. If a user has progressed beyond the hello flow, then they get sent to the last position in their session. It could be any other flow and state you have specified.
So when a user types a random string into your bot, it wouldn't be the responsibility of the route
method to determine what to do with it, it would be whatever state the user is in that may be expecting a response. In most cases you should try to design the response to be simple. So for a Facebook bot, we recommend utilizing quick replies and buttons. But certainly you may have open ended user input that needs validation or NLP. For NLP, we currently have integrated AWS Comprehend (https://github.com/hellostealth/stealth-aws-comprehend) but you could also add in support for others.
I recommend checking our docs on sessions: https://hellostealth.org/docs/#sessions. Hopefully we'll have screencasts available soon that will make this all more clear.
from stealth.
Related Issues (20)
- Run CircleCI tests on Ruby 2.7
- Messages that are alpha ordinals should take precedence
- Add options to flow states
- Add support for "any" message in handle_message()
- Add NLP threshold setting for intent and entity detection
- Configurable expiration time for CaltchAll max fails attempts
- Support alpha ordinals with punctuation
- Error to connect to database HOT 1
- Stealth Twilio Integration HOT 1
- Add support for Array types in handle_message
- Experiment moving test suite to Github Actions HOT 1
- Add test coverage for TruffleRuby HOT 1
- Upgrade to Sinatra 2.1
- Upgrade listen gem to 3.3.x
- Configuration in initialiser ignored HOT 4
- Integration api instagram HOT 1
- Is it possible to mount a Stealth bot inside an existent Rails app? HOT 2
- `Zeitwerk::SetupRequired` for Zeitwerk 2.6.6
- Compatibility with RSpec-Rails
- Send additional context to NLP drivers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stealth.