fancyhands-node

0.1.3 • Public • Published

Node wrapper for Fancyhands' API

For more information visit the Fancyhands API Docs

Installation

If you don't have node installed, get it at nodejs.org

Then run:

npm install fancyhands-node --save

Getting your Key and Secret

Go to the Fancy Hands API site to get your OAuth credentials.

Example

var FH = require('fancyhands-node').fancyhands;
 
// Configuration
FH.config('YOUR_API_KEY', 'YOUR_API_SECRET');
 
// Create a Standard Request
var request = {
    title: 'Test Request, do not claim!',
    description: 'Do not send to support',
    bid: 3
};
 
// Send the request.
// The method returns a promise. Use the 'then' method to pass in response and error handlers.
FH.standard_request_create(request)
    .then(function(request) {
    
        // print out what we got
        console.log("Success! Request created");
        console.log(request);
        
        // send a message to this request...
        FH.message_send({ key: request.key, message: "And one more thing..." })
            .then(function(data) {
                console.log("Success! Message sent");
                console.log(data);
            });
});
 
 
FH.standard_request_get().then(function(data) {
    var requests = data.requests;
    for(var i = 0; i < requests.length; ++i) {
        console.log(requests[i].title);
    }
});
 

Methods

All methods return a promise. We use the Q Promise Library, read more about it here.

Utility

FH.post( url, params (Object) )
Manual POST to Fancyhands. Can use any API method.

FH.get( url, params (Object) )
Manual GET from Fancyhands. Can use any API method.

FH.put( url, params (Object) )
Manual PUT to Fancyhands. Can use any API method.

FH.delete( url, params (Object) )
Manual DELETE from Fancyhands. Can use any API method.

FH.echo( <params Function|Object|number|string> )
We'll echo back whatever params you send. Use to test your API key and secret.

Incoming Calls

FH.incoming_call_create( params (Object) )
Allows you to create a new Incoming Call Object, with custom built script for our assistants to read.

FH.incoming_call_get( params (Object) )
Retrieves a list or specific Incoming call objects

FH.incoming_call_update( params (Object) )
Updates an Incoming call object

FH.incoming_call_delete( params (Object) )
Deletes an Incoming call object

FH.incoming_call_history( params (Object) )
Gets a list of all calls made on an Incoming call object

FH.number_search( params (Object) )
Search for an available phone number to buy and returns a list of them

FH.number_buy( params (Object) )
This method allows you to purchase a phone number that will be used as your incoming call display number.

FH.number_delete( params (Object) )
his method allows you to delete a previously purchased number, you will no longer be billed for it.

Outgoing Calls

FH.outgoing_call_create( params (Object) )
Specifically for making phone calls and getting structured data back. Super fast!

FH.outgoing_call_get( params (Object) )
Returns list of created calls

Custom Requests

FH.custom_request_create( params (Object) )
Make a request and get customized structured data back.

FH.custom_request_get( params (Object) )
Returns list of created custom requests

FH.custom_request_cancel( params (Object) )
Cancel a request before you get billed for it.

Standard Requests

FH.standard_request_create( params (Object) )
Make a request and get freeform data back.

FH.standard_request_get( params (Object) )
Return list of created standard requests.

Messages

FH.message_send( params (Object) )
Send a message to the assistant working on a task

Readme

Keywords

none

Package Sidebar

Install

npm i fancyhands-node

Weekly Downloads

108

Version

0.1.3

License

none

Last publish

Collaborators

  • orrybaram
  • tedroden