Modules@robinpath/freshbooks
freshbooks

@robinpath/freshbooks

0.1.1Node.jsPublic

FreshBooks module for RobinPath.

FreshBooks

FreshBooks module for RobinPath.

Package: @robinpath/freshbooks | Category: Finance | Type: Integration

Authentication

freshbooks.setCredentials "your-credentials"

Call this once at the start of your script before using any other function. Credentials persist for the duration of the script execution.

Use Cases

Use the freshbooks module when you need to:

  • listClients -- Use freshbooks.listClients to perform this operation
  • getClient -- Use freshbooks.getClient to perform this operation
  • createClient -- Use freshbooks.createClient to perform this operation
  • updateClient -- Use freshbooks.updateClient to perform this operation
  • listInvoices -- Use freshbooks.listInvoices to perform this operation

Quick Reference

FunctionDescriptionReturns
setCredentialsConfigure freshbooks credentials.object
listClientslistClientsobject
getClientgetClientobject
createClientcreateClientobject
updateClientupdateClientobject
listInvoiceslistInvoicesobject
getInvoicegetInvoiceobject
createInvoicecreateInvoiceobject
updateInvoiceupdateInvoiceobject
sendInvoicesendInvoiceobject
listExpenseslistExpensesobject
getExpensegetExpenseobject
createExpensecreateExpenseobject
listTimeEntrieslistTimeEntriesobject
createTimeEntrycreateTimeEntryobject
listPaymentslistPaymentsobject
createPaymentcreatePaymentobject
getUsergetUserobject
getAccountgetAccountobject

Functions

setCredentials

Configure freshbooks credentials.

Module: freshbooks | Returns: object -- API response.

freshbooks.setCredentials
ParameterTypeRequiredDescription
accessTokenstringYesaccessToken
accountIdstringYesaccountId

listClients

listClients

Module: freshbooks | Returns: object -- API response.

freshbooks.listClients
ParameterTypeRequiredDescription
inputstringNoInput parameter

getClient

getClient

Module: freshbooks | Returns: object -- API response.

freshbooks.getClient
ParameterTypeRequiredDescription
inputstringNoInput parameter

createClient

createClient

Module: freshbooks | Returns: object -- API response.

freshbooks.createClient
ParameterTypeRequiredDescription
inputstringNoInput parameter

updateClient

updateClient

Module: freshbooks | Returns: object -- API response.

freshbooks.updateClient
ParameterTypeRequiredDescription
inputstringNoInput parameter

listInvoices

listInvoices

Module: freshbooks | Returns: object -- API response.

freshbooks.listInvoices
ParameterTypeRequiredDescription
inputstringNoInput parameter

getInvoice

getInvoice

Module: freshbooks | Returns: object -- API response.

freshbooks.getInvoice
ParameterTypeRequiredDescription
inputstringNoInput parameter

createInvoice

createInvoice

Module: freshbooks | Returns: object -- API response.

freshbooks.createInvoice
ParameterTypeRequiredDescription
inputstringNoInput parameter

updateInvoice

updateInvoice

Module: freshbooks | Returns: object -- API response.

freshbooks.updateInvoice
ParameterTypeRequiredDescription
inputstringNoInput parameter

sendInvoice

sendInvoice

Module: freshbooks | Returns: object -- API response.

freshbooks.sendInvoice
ParameterTypeRequiredDescription
inputstringNoInput parameter

listExpenses

listExpenses

Module: freshbooks | Returns: object -- API response.

freshbooks.listExpenses
ParameterTypeRequiredDescription
inputstringNoInput parameter

getExpense

getExpense

Module: freshbooks | Returns: object -- API response.

freshbooks.getExpense
ParameterTypeRequiredDescription
inputstringNoInput parameter

createExpense

createExpense

Module: freshbooks | Returns: object -- API response.

freshbooks.createExpense
ParameterTypeRequiredDescription
inputstringNoInput parameter

listTimeEntries

listTimeEntries

Module: freshbooks | Returns: object -- API response.

freshbooks.listTimeEntries
ParameterTypeRequiredDescription
inputstringNoInput parameter

createTimeEntry

createTimeEntry

Module: freshbooks | Returns: object -- API response.

freshbooks.createTimeEntry
ParameterTypeRequiredDescription
inputstringNoInput parameter

listPayments

listPayments

Module: freshbooks | Returns: object -- API response.

freshbooks.listPayments
ParameterTypeRequiredDescription
inputstringNoInput parameter

createPayment

createPayment

Module: freshbooks | Returns: object -- API response.

freshbooks.createPayment
ParameterTypeRequiredDescription
inputstringNoInput parameter

getUser

getUser

Module: freshbooks | Returns: object -- API response.

freshbooks.getUser
ParameterTypeRequiredDescription
inputstringNoInput parameter

getAccount

getAccount

Module: freshbooks | Returns: object -- API response.

freshbooks.getAccount
ParameterTypeRequiredDescription
inputstringNoInput parameter

Error Handling

All functions throw on failure. Common errors:

ErrorCause
Freshbooks API error (${res.status}): ${t}Check the error message for details
freshbooks.setCredentials requires accessToken, accountId.Check the error message for details
freshbooks.updateClient requires an ID.Check the error message for details
freshbooks.updateInvoice requires an ID.Check the error message for details
Freshbooks: "..." not configured. Call freshbooks.setCredentials first.Check the error message for details
@desc "List clients and validate result"
do
  set $result as freshbooks.listClients
  if $result != null
    print "Success"
  else
    print "No result"
  end
enddo

Recipes

1. List and iterate Clients

Retrieve all items and loop through them.

@desc "Setup authentication"
do
  freshbooks.setCredentials $token
enddo

@desc "List clients and iterate results"
do
  set $result as freshbooks.listClients
  each $item in $result
    print $item
  end
enddo

2. Create a new item with createClient

Create a new resource and capture the result.

@desc "Setup authentication"
do
  freshbooks.setCredentials $token
enddo

@desc "Create client"
do
  set $result as freshbooks.createClient
  print "Created: " + $result
enddo

3. Create and update workflow

Create an item and then update it.

@desc "Setup authentication"
do
  freshbooks.setCredentials $token
enddo

@desc "Create client and update client"
do
  set $created as freshbooks.createClient
  # Update the created item
  freshbooks.updateClient
enddo

4. Check before creating

List existing items and only create if needed.

@desc "Setup authentication"
do
  freshbooks.setCredentials $token
enddo

@desc "List clients and create client"
do
  set $existing as freshbooks.listClients
  if $existing == null
    freshbooks.createClient
    print "Item created"
  else
    print "Item already exists"
  end
enddo

5. Multi-step FreshBooks workflow

Chain multiple freshbooks operations together.

@desc "Setup authentication"
do
  freshbooks.setCredentials $token
enddo

@desc "List clients, get client, and more"
do
  set $r_listClients as freshbooks.listClients
  set $r_getClient as freshbooks.getClient
  set $r_createClient as freshbooks.createClient
  print "All operations complete"
enddo

6. Safe listClients with validation

Check results before proceeding.

@desc "Setup authentication"
do
  freshbooks.setCredentials $token
enddo

@desc "List clients and validate result"
do
  set $result as freshbooks.listClients
  if $result != null
    print "Success: " + $result
  else
    print "Operation returned no data"
  end
enddo

Related Modules

  • quickbooks -- QuickBooks module for complementary functionality
  • xero -- Xero module for complementary functionality
  • invoice -- Invoice module for complementary functionality
  • json -- JSON module for complementary functionality

Versions (1)

VersionTagPublished
0.1.1latest1 months ago
Install
$ robinpath add @robinpath/freshbooks

Collaborators

Dumitru Balaban
Dumitru Balaban
@dumitru
View all @robinpath modules
Version0.1.1
LicenseMIT
Unpacked Size4.7 KB
Versions1
Weekly Downloads26
Total Downloads26
Stars0
Last Publish1 months ago
Created1 months ago

Category

sales