davidmann4 / botstack

rapid chatbot development with ruby on rails
127 stars 23 forks source link

Introducing: Webviews for Botstack #33

Open davidmann4 opened 7 years ago

davidmann4 commented 7 years ago

@pferdefleisch @ramonh @tosh @christophrumpel @legeekette @toshe @Cryt1c @evo42

Hi,

with https://github.com/davidmann4/botstack/commit/9c66197db9891c6953a6504674a8a024c7828ec9 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

mraaroncruz commented 7 years ago

I'm looking forward to see how you implemented this. You might want to look into https://github.com/trailblazer/cells for this. May be overkill but this is a great use case for it.

tosh commented 7 years ago

I haven't (camera) but @sido378 & @allanberger might know if camera access is already supported in webviews

davidmann4 commented 7 years ago

if you have ideas for webviews let me know - currently on the roadmap: datepicker: from - to datepicker: single_date datepicker: single_date_with_time

christophrumpel commented 7 years ago

Have to day I haven't used them before, but I will let you know when I have some ideas.