Implementing chat in Rails - ruby

I am trying to implement a chat module in my rails application. I looked into this railscast Faye tutorial. More through the tutorial, Ryan mentions about broadcasting the messages but what I want is more like private conversations between the clients instead of broadcasting.
Is it possible to do that through faye? or is there a better way of implementing chat in rails?

There is a gem that handles the autentications for you for faye, so users can only listen on channels you subscribe them to. There is also a railscast talking about that gem.
https://github.com/ryanb/private_pub

I don't know much about Faye, but assuming the principles are the same as with something like pure node.js and websockets, you'd divide the channels that can be subscribed to down into as many chats as there are occurring, then you'd require some sort of authentication before a client can subscribe to that channel, of which there are numerous approaches, as with most authentication systems (e.g. shared secret, username/password, challenge/response etc).

I have used Ryan's tutorial on private_pub to achieve an a Gmail like instant messaging feature. It's actually not very complex. See how I achieved it in this tutorial http://goo.gl/l3e8zN

Related

Chatbot handoff from Messenger to Zendesk

I am developing a customer service chatbot, using Azure's Bot Framework in .NET, using the the Messenger channel. I wanted to know if anyone knows what the best way to handle the handoff to a human on Zendesk (which my platform already uses as its CRM platform). I'm not looking for when to do the handoff, but how to manage what happens next.
What I would love to be able to do would be that so when handoff is needed, a ticket on Zendesk would be created, sending for example a file (the transcript of the conversation so far). Then the agent would be able to solve the customer's problem in that ticket, having a conversation with him, having the bot sending messages back and forth between zendesk and messenger.
I don't know if this has been done before, or if it's at all possible. And I'm free to other solutions to the problem of handling this kind of handoff, without having to create a separate "chat" for the customer service agents to use, like it's explained on the azure documentation.
Thank you for your patience while I researched this. I found this resource that I believe will meet your needs. This functionality is built off of the Bot Framework utilizing .NET (it's also available for Nodejs). There are two available methods to connect a client to an agent.
The first (which should apply to you) aggregates different channels into one allowing an agent to pickup in the same channel where the bot handed off. The second opens a new channel when an agent joins the conversation.
Intermediator Bot
I was able to spin up a bot using this and confirmed the bot was listening for outside traffic.
Hope this helps.
Steve.
One thing that I'm about to try is this:
Bot conversation ends.
Bot service calls an Azure Function, passing the conversation content.
The Azure Function integrates with Trello API, creating an entry on a Kanban board.
So, instead of Trello as I want to do, you can make a call to the Zendesk API.
I'm writing a few articles about developing Azure bots. The next two actually are dealing with these very things. You can find out more here. sign up if you'd like to get notified over the next week or so when the new tutorials are online.
Hope that helps!
Tim

Deploy Hubot on AWS Lambda?

I'm a noob using Hubot, so please bear with me.
I was going through Hubot's documentation ( https://hubot.github.com/docs/deploying/ ) and saw that we can deploy to Heroku, Unix systems and others.
May I know how can Hubot be deployed on AWS Lambda ?
Best Regards.
I was wondering the same thing. I think the answer is probably "yes, if your chat system can send you http when traffic happens". I think Lambda is probably a great choice, since each message in chat is an event to process according to the rules that your bot has. So, the Lambda function invocation model is a good fit - lots of tiny invokes. You might, though, want to filter the traffic that gets to the function, though, if your chat system is high-traffic.
For example Slack's Events API lets you subscribe to all of the things you might need the bot to see, I think. You'd then need to route those requests to your lambda function, which you could do via AWS API Gateway.
The existing hubot-slack adapter uses the Real-Time Messaging API, though, so you'd need to write your own adaptor for the Events API http that the API Gateway receives.
The same approach (and requirement) applies to other chat systems.

rails 3.1 realtime update feature

I've seen many sites that their messages feed is keep sliding down incessantly.
For example: the previous version of twitter and now the foursquare. How to do that?
Moreover, I also want to know how to implement meetup's RSVP instant push in rails, they update it by seconds?
Thanks.
These companies will most likely be using realtime web technologies. Here are a few you could use with a rails and/or ruby applications:
http://juggernaut.rubyforge.org/
http://faye.jcoglan.com/
http://cramp.in/
https://github.com/raggi/async_sinatra
http://postrank-labs.github.com/goliath/
You could also use Pusher (who I work for) as we have a Pusher gem. If you do this it means you are not hosting the realtime infrastructure yourself.

Handle skype message using Ruby

Is there any library that allows to handle Skype messages using Ruby?
Take a look at this: http://rubyforge.org/projects/skyperapper
If you are using JRuby http://skype.sourceforge.jp/ might be a better option
For the public API doc: http://developer.skype.com/accessories
You can use the RestClient gem and the tropo.com service to send and receive Skype IMs. See the documentation for their REST api here:
https://www.tropo.com/docs/scripting/message.htm?search=skype#anchor
They're currently not charging for the service that sends/receives instant messages.
There are currently two ways of accessing the Skype network in a sanctioned manner. The first is the Skype Public API, which requires talking to the official Skype client running on a local machine. The other is SkypeKit which I am led to believe has a very restrictive agreement attached to it.
SkypeKit for ruby is available as a gem here.
The following is historical only; Skype no longer supports the Public API for their client. I have also been working on a Ruby wrapper around the Skype Public API. It's far from finished at the moment but supports Windows and Linux currently (OSX should be easy to implement as well, however I currently don't have a Mac) and allows you to connect and send commands to Skype manually. Long term the entire API will be wrapped.
In the interests of full disclosure, there seem to be a few other projects hanging around too, however they seem to only target a single platform and the ones I found seem to be abandonware at the moment.
libpurple have a plugin for Skype, but this is not easy to Setup.
Unfortunately, Skype protocol is closed & encripted, so there are no good libs out there.

What solution would you suggest for implementing both chat and IM on the site?

Should I pick up IRC or go another route? What I need are public chat and private instant messaging on my social network. I do not wish to use 3rd-party solutions. (I plan to rent VPS for the matter.)
Well IRC is always good for chat, not so much for IM, unless you use DCC or Queries, and that could get complicated. If you're advanced in all of this, I suppose IRC would work for private messaging, but you should definitely think of something else instead.
(But keep in mind that IRC is absolutely wonderful for public chatting)
You could try Jabber/XMPP. Jabber's a chat "application" built on top of the XMPP message transport layer; XMPP also supports direct user-to-user messaging, which is your IM. I've seen implementations of clients that were in webpages (AIUI, it's used to power GTalk and Google Wave) and there are numerous client applications available.

Resources