davidmann4 / botstack Goto Github PK
View Code? Open in Web Editor NEWrapid chatbot development with ruby on rails
rapid chatbot development with ruby on rails
The HTML parsing demo is pretty cool, man
Class methods are great for factories but besides that they can be harmful. Especially when all of the domain logic lives in the class.
http://blog.codeclimate.com/blog/2012/11/14/why-ruby-class-methods-resist-refactoring/
@pferdefleisch @ramonh
cc: @tosh
played around with rspec to make it possible to make tests.. now I wonder how we want to do this :)
https://github.com/davidmann4/botstack/blob/master/spec/bot_spec_helper.rb
https://github.com/davidmann4/botstack/blob/master/spec/lib/basic_functionality_spec.rb
I guess we want to be able to test whole conversations?
But on the other hand rspec maybe should just cover botstack mechanics?
really curious about your opinion...
@ramonh I am thinking of the best way of defining bubbles with code:
send_bubble "http://image.com/image.png \n HEADLINE \n subheadline "
#or something like this?
send_bubble [{image: "http://", headline: "headline", description: "description"}]
also you can add buttons to them - hmm
another aproach would be content based:
send_bubble_websites --> list of urls, bots get title of websites and preview images etc ...
I am curious what you think about this topic!
write specs
It looks like part of a library where it is actually an example.
Whereas app/bots/main.rb looks like it might belong in lib
could be used for multi platform
sometimes user click twice, will result in triggering a double response
query
context
fb_first_name
fb_last_name
fb_timezone
fb_locale
fb_gender
fb_profile_pic
fb_id
last_clicked_button_name
last_processed_block_name
last_processed_block_id
handle last online
It would be nice if we would provide a tos.html file which provides a basic tos for the bot app used for the bot service ( fb app review) I guess this tos is different to the tos of the bot2user relation.
botstack <-- tos.html --> facebook <-- bot2user_tos.html --> user
any ideas?
@pferdefleisch @ramonh @tosh @christophrumpel @legeekette @toshe @Cryt1c @evo42
Hi,
with 9c66197 I've added webview support. Now I am thinking about common webviews users would might need.
so far I´ve added a datepicker. Feel free to brainstorm Ideas.
@tosh: you already played around with camera support in webviews?
cheers,
David
how it works: bot framework creates a link to the webview - user has a small browser which loads a rails servlet. The HTML5 site makes a post request to another servlet which handles the request like a normal message. ecample: https://github.com/davidmann4/botstack/blob/master/app/views/webview/date_picker.html.erb
security: i generate a token (HMAC(user_id, rails_random_secret)) to sign the url of the webview. The webview also has a CSRF field. https://github.com/davidmann4/botstack/blob/master/app/controllers/webview_controller.rb#L6
I'd like to use Sinatra or just plain Rack to build a bot with the framework since the routing layer is the least interesting and complicated part of building a chatbot.
Relying on Rails, its memory footprint and bundled goodies that botstack would never use seems like overkill.
We just need two routes:
GET
POST
You would still get the benefits of being able to choose the endpoint (even in a Rack app) using Rack's map
method.
Also necessary would be an integration guide for Rails, Sinatra and Rack in the docs.
What do you think?
handle throttling of mass messaging - via user profile?
@pferdefleisch what's a good tool to document rails apps? or should I just add a docs/ folder and put *.MD files into it?
I am constantly running into this same issue while developing. I get an error and the app crashes. I fix the error, and when testing again it crashes because it registers the previously sent message as the current one. Any way to reset the messages sent to the bot through FB messenger?
Hi,
I was just toying around with the bot but I think I broke it. In my first conversation the bot stopped replying, not sure what action or text did this. The console shows the following error:
Facebook::Messenger::Bot::RecipientNotFound ((#100) No matching user found):
lib/bot/base_bot_logic.rb:33:in `reply_message'
lib/bot/bot_logic.rb:25:in `bot_logic'
lib/bot/base_bot_logic.rb:207:in `handle_request'
app/bots/main.rb:7:in `block in <top (required)>'
The "RESET" replys with a text, but my other reply is not sent. My bot logic is this:
class BotLogic < BaseBotLogic
def self.setup
set_welcome_message "Hey! Interesse an einer Domain? Ich kann Dir gerne sagen, ob eine Domain Deiner Wahl verfügbar ist!"
set_get_started_button "bot_start_payload"
set_bot_menu
end
def self.cron
broadcast_all ":princess:"
end
def self.bot_logic
ENV["DOMAIN_NAME"] = "https://2c654be7.eu.ngrok.io/"
if @request_type == "CALLBACK" and @fb_params.payload == "RESET_BOT"
@current_user.delete
reply_message "Removed all your data from our servers."
return
end
return reply_message "This is never sent"
end
end
What did I do wrong?
switch to other gem
I clone the project and when I run rspec
, this happens:
Verify the bot with the following verify_token :github
/home/luiz/.rvm/gems/ruby-2.3.3/gems/webmock-2.3.1/lib/webmock/http_lib_adapters/net_http.rb:114:in `request': Real HTTP connections are disabled. Unregistered request: POST https://graph.facebook.com/v2.6/me/thread_settings?access_token= with body '{"setting_type":"call_to_actions","thread_state":"existing_thread","call_to_actions":[{"type":"postback","title":"Reset","payload":"RESET_BOT"},{"type":"postback","title":"Info","payload":"INFO_BOT"}]}' with headers {'Content-Type'=>'application/json'} (WebMock::NetConnectNotAllowedError)
You can stub this request with the following snippet:
stub_request(:post, "https://graph.facebook.com/v2.6/me/thread_settings?access_token=").
with(:body => "{\"setting_type\":\"call_to_actions\",\"thread_state\":\"existing_thread\",\"call_to_actions\":[{\"type\":\"postback\",\"title\":\"Reset\",\"payload\":\"RESET_BOT\"},{\"type\":\"postback\",\"title\":\"Info\",\"payload\":\"INFO_BOT\"}]}",
:headers => {'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => "", :headers => {})
for intends
@ginccc glaubst du brauche ich die message history local oder soll ich einfach einen 3rd party analytics service benutzen?
siehe:
#3 (http://www.dashbot.io/)
#2 (https://bot-metrics.com/)
ich kann ja den derzeitigen state der user in der state machine halten - die frage ist ob es manchmal cases gibt wo man im nachhinein Auswertungen auf die History machen will... hmm tricky
lg
David
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.