node package manager

fastpass

A node.js library for getsatsfaction fastpass

node-fastpass

A node.js library for getsatisfaction fastpass (single sign-on)

This serves as a drop-in replacement for the existing getsatisfaction fastpass libraries, and implements the same method signatures (with some defaulting for ease of use) as the ruby library. Documentation for existing fastpass libraries can be found on the getsatisfaction help site.


Usage:

Add the dependency:

npm install --save fastpass

Require it:

var FastPass = require('fastpass')

Instantiate it:

var fastPass = new FastPass({
   // optional, defaults to "getsatisfaction.com"
   domain : "getsatisfaction.com",
   // required, your consumer key
   consumer_key : "xi2vaxgpp06m",
   // required, your consumer secret
   consumer_secret : "ly68der0hk8idfr5c73ozyq56jpwstd1",
   // optional at instantiation - email of the user
   email : "scott@getsatisfaction.com",
   // optional at instantiation - Name of the user
   name : "Scott",
   // optional at instantiation - unique ID of user (must stay the same for the lifetime the user in your system)
   unique_identifier : "nullstyle",
   // optional boolean, defaults to false
   is_secure : false,
   // optional object, any private fields you like. defaults to {}.
   private_fields : {}
})

Implementation:

Using the Script tag

fastPass.script({
  email : "scott@getsatisfaction.com",
  name : "Scott",
  unique_identifier : "nullstyle"
}, function(err,script){
  var outputScript = script
})

or if you passed name, unique_identifier, and email at instantiation:

fastPass.script(function(err,script){
  var outputScript = script
})

Now replace all links to getSatisfaction with calls to GSFN.goto_gsfn()

// for instance, in jQuery
$('body').on('click','a[href="http://getsatisfaction.com"]',function(){ GSFN.goto_gsfn(); return false; })

Using Cookies along with CNAME

Set a cookie named "fastpass" to the URL generated by the FastPass library. Note: This is only available if your company is using the CNAME feature.

// inside of an express route or whatever:
fastPass.url(<options>,function(err,url){
  cookies["fastpass"] = url
})

Using the Query String

Include the generated URL in the param named "fastpass" in all links to Get Satisfaction.

// in some template context
fastPass.url(<options>,function(err,url){
  var linkUrl = "<a href="http://getsatisfaction.com/mycompany?fastpass=" + url + ">Our Support Community</a>"
})

Option Details:

Field         |  Required  |  Notes
Key           |    Yes     |
Secret        |    Yes     |
Email         |    Yes     |
Name          |    Yes     |
Unique Id     |    Yes     | Must remain unchanged for the lifetime of the user's account in your system.
Is Secure     |    No      | (defaults to false)
Private Fields|    No      | Key/value pairs to send along with the user to Get Satisfaction.