Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: a552842ada
Fetching contributors…

Cannot retrieve contributors at this time

103 lines (78 sloc) 3.718 kB

Web-To-Lead Capture Plugin for Fat Free CRM

This plugin shows how to implement Fat Free CRM application controller callback hook to capture lead data submitted from remote form. For more information about Fat Free CRM visit


The plugin installs just like any Ruby on Rails plugin packaged as git. Assuming that you have Fat Free CRM up and running:

$ ./script/install plugin git://

The sample plugin will be installed in vendor/plugins/crm_web_to_lead directory.

Quick How To

To submit a lead remote form should POST two extra hidden fields to identify the user who will own the lead:

<input type="hidden" name="authorization" value="-- password_hash here --">
<input type="hidden" name="token" value="-- password_token here --">

Two more hidden fields specify redirection URLs to handle successful submissions and possible validation errors:

<input type="hidden" name="on_success" value="-- fuccess URL here --">
<input type="hidden" name="on_success" value="-- failure URL here --">

The following sample is a good start to build your own lead capture form.

  <form action="http://localhost:3000/leads/create" method="post">
    <input name="lead[first_name]" value="">
    <input name="lead[last_name]" value="">
    <input name="lead[source]" value="Web">
    <input name="authorization" value="?">
    <input name="token" value="?"
    <input name="on_success" value="">
    <input name="on_failure" value="">
    <input type="submit" value="OK">

Replace question marks with the actual values of password_hash and password_token as set in users table. Successful lead submissions get logged in Rails log file.


Alternative Signup with XML

To submit new leads via xml (useful for inline code submissions to a synced app or via AJAX). Default root xml element should be :“ffcrm”, this is required to ensure the parameters are checked correctly.

On source app :

#Required fields:
#access, do-not-call, first-name, last-name 
 xml =
 xml.ffcrm do
    xml.lead do
      xml.access "Public" #or Private 
      xml.address "1234 Sample Address", "nil" => "true"
      xml.tag!("alt-email", "", "nil" => "true")
      xml.tag!("assigned-to", "", "nil" => "true", "type"=>"integer") "", "nil" => "true"
      xml.tag!("campaign-id", "", "nil" => "true", "type"=>"integer") "", "nil" => "true"  
      xml.tag!("do-not-call", "false", "type"=>"boolean") "", "nil" => "true" 
      xml.tag!("first-name", "Foo")
      xml.tag!("last-name", "Bar") "", "nil" => "true" "", "nil" => "true"
      xml.tag!("referred-by", "", "nil" => "true")
      xml.source "", "nil" => "true"
      xml.status "", "nil" => "true"
      xml.title "", "nil" => "true"
      xml.tag!("user-id", "", "type" => "integer", "nil" => "true") 
      xml.tag!("uuid", "", "nil" => "true")                               
    xml.authorization "password_hash for user in Fat Free CRM"
    xml.token "password_salt for user in Fat Free CRM"       

#Add to fat free CRM url = URI.parse('localhost:3000/leads.xml') request = request.content_type = 'text/xml' request.body =! response = Net::HTTP.start(, url.port) {|http| http.request(request)}

Copyright © 2009 by Michael Dvorkin, released under the MIT license.

Jump to Line
Something went wrong with that request. Please try again.