Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Zendesk on Rails - Dropbox and Remote Authentication


The plugin implements the HTML generation code for the Zendesk dropbox and the necessary controller and routing code to implement Zendesk's remote authentication


Via RubyGems:

gem install panmind-zendesk

Or via Rails Plugin:

rails plugin install git://


In your config/routes.rb:

map.zendesk '/support', :controller => 'sessions'

The /support path will then respond to the methods that generate the query string parameters required for Remote Authentication, while the /support/exit path will simply set a notice in the flash and redirect the user to the app root_url. You can override this behaviour by implementing a zendesk_logout method in the controller.

You can define these methods in any of your controllers, in this example we defined it in the SessionsController: so, in your sessions_controller.rb:

include Panmind::Zendesk::Controller if Panmind::Zendesk.enabled?

Finally, in your config/environment.rb:

  :token     => 'Your Zendesk token',
  :hostname  => '',
  :login     => proc { [,] },
  :login_url => :login_url,
  :dropbox   => {
    :title => 'Dropbox title',
    :email => proc { rescue nil }

The required options are:

  • :token -- your zendesk shared secret
  • :hostname -- your zendesk account host name
  • :login -- a Proc object evaluated in the controller instance context, that must return an Array whose first element is the current user name and the second its email. This Proc is evaluated iff the logged_in? instance method of your controller returns true.
  • :login_url -- The name of the named route helper that generates the full URL of your login page. We use :ssl_login_url thanks to our SSL Helper plugin.

The :dropbox option is for the Zendesk dropbox configuration, it should be an hash with symbolized keys and it is converted to JSON and bound to the zendesk_params Javascript variable.

To facilitate the Dropbox usage, the :email option can be a Proc object that is then evaluated in the controller instance context and should return the current user e-mail or nil if the user is not logged in. If the :email option is unset no e-mail appears precompiled in the Dropbox for, or you could even set a static email for every feedback request (dunno why should you do that, though :-).


To embed the Dropbox tags, use the zendesk_dropbox_tags helper in your layout:

<%= zendesk_dropbox_tags %>

To display a link that displays the dropbox when clicked use the zendesk_dropbox_link_to helper in your views:

<%= zendesk_dropbox_link_to 'Send feedback' %>

To display a link that starts the Remote Authentication process use the zendesk_link_to helper in your views:

<%= zendesk_link_to 'Support' %>

The second parameter of said helper is passed to Rails' link_to one to customize the link tag attributes.


If you implement asset minifization and concatenation, you'll surely want to reduce HTTP requests to external services. While it's not the best practice in the world to cache said services assets, to speed up your application you may be forced to do it.

We're doing it on Panmind - both to reduce the number of HTTP requests and because the lag with from Europe is quite high.

To make a long story short, if you're including the Zendesk assets in your minified blobs, you can use just the zendesk_dropbox_config view helper to generate the dropbox configuration, placing it before the inclusion of your JS blobs: this way the zenbox_params variable will be already defined when the JS is evaluated.

If you're wondering how we're minifying and concatenating our JS and CSS assets, follow us on GitHub: we plan to release that code as well. :-)


Tested with Rails 3.0.3 running under Ruby 1.9.2p0.


  • Your login action must implement a redirect_to params[:return_to] || some_other_url or redirects to Zendesk won't work: remove relying on this assumption. Cleanly.
  • Clean up configuration by requiring less variables: convention over configuration!
  • Configuration of the logged_in? method name
  • Allow options passing to the zendesk_dropbox_link_to helper
  • Code documentation
  • Tests (yuck!)

Please fork the project and send us a pull request if you check off any of these items from the to-do list, or for any other improvement. Thanks! :-)


Zendesk on Rails -- dropbox and remote authentication






No packages published