Torch POST/JSON WebHook

Torch Project Management supports a universal JSON, POST or GET (not recommended) request to the webhook url (available under the help section) that creates a message. In both cases the variables are named "title" and "body". In the case of the JSON, the entire payload should be placed in the POST variable "json". Most programming languages have built in functions for creating JSON payloads (e.g. PHP, Ruby, Java).

A typical JSON payload might look like this:

Code:

Download
{
"title":"Talked to the Client",
"body":"Spent time with client \n\n[time:Time with client:2.5]"
}

The body variable will be parsed for task/event, pin, time, expense, category and complete entries as described in the help section (and you can have as many of these as you want).

You can also post a JSON payload that creates a time or expense entry directly:

Code:

Download
{
"hours":"2:15",
"note":"Work with client",
"category":"Meetings",
"timestamp":"2010-07-04"
}

Or:

Code:

Download
{
"price":"200",
"note":"New Widget",
"category":"Toys",
"timestamp":"2010-07-04"
}


You can also retrieve time and expense data in JSON format by adding the GET or POST variable "list" with a value of either "time", "expenses" or "invoices". A typical JSON response might look like this:

Code:

Download
[{
    "key": "876",
    "timestamp": "2009-11-23 00:00:00",
    "hours": "5.000000",
    "note": "Graphics",
    "category": "Newsletter One",
    "invoicename": "",
    "user": "Ben Smith",
    "billrate": "100.000000",
    "cost": "500.000000000000",
    "projectbudget":"200.00",
    "categorybudget":"100.00"
},
{
    "key": "877",
    "timestamp": "2009-11-23 00:00:00",
    "hours": "1.000000",
    "note": "Logo",
    "category": "Newsletter One",
    "invoicename": "",
    "user": "Ben Smith",
    "billrate": "100.000000",
    "cost": "100.000000000000"
    "projectbudget":"200.00",
    "categorybudget":"100.00"
}]


There is some Google Apps Scripts sample code retrieving data in this method available here.

Related Documents:

Sending Google Form Submissions to Torch
Using Google Apps Scripts and the JSON WebHook, you can create all sorts of data in Torch automatically