There is no license information available for the latest version (dev-master) of this package.

A PHP Wrapper for the Teamwork Desk API

dev-master 2016-05-05 20:07 UTC

This package is auto-updated.

Last update: 2021-04-29 00:29:57 UTC


I wrote this completely out of necessity. As of writing this there are no other PHP wrappers for this API, Zapier doesn't support it, and no one that I can find is talking about it. We wanted to switch to Teamwork Desk from Zendesk because of the great integrations with Teamwork Projects, and some of the useful features Teamwork Desk offers are not available in Zendesk.

As for the API, I found some API-looking calls when I watch the network usage in Teamwork Desk, and I assumed the authentication would be the same as Teamwork Projects. After some testing, I found that the API exists and the offical Teamwork Desk documentation can be found here. Feel free to suggest changes and additions.

Getting Started:

Define two constants, TEAMWORK_DESK_DOMAIN and TEAMWORK_DESK_KEY with your Teamwork Desk domain and your API key.

define('TEAMWORK_DESK_DOMAIN',   '');
define('TEAMWORK_DESK_KEY',      'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');

Next, there are some classes you can use:

$alert          = new Teamwork\Desk\Alert();
$customer       = new Teamwork\Desk\Customer();
$inbox          = new Teamwork\Desk\Inbox();
$plan           = new Teamwork\Desk\Plan();
$setting        = new Teamwork\Desk\Setting();
$ticket         = new Teamwork\Desk\Ticket();
$ticketPriority = new Teamwork\Desk\TicketPriority();
$ticketSource   = new Teamwork\Desk\TicketSource();
$ticketStatus   = new Teamwork\Desk\TicketStatus();
$ticketType     = new Teamwork\Desk\TicketType();
$user           = new Teamwork\Desk\User();

From there, there are some common methods:

$ticket->getAll(['sortBy' => 'id']);

Also, you can access properties of the objects like this:

echo $ticket->subject;
$ticketNumber = $ticket->id;

You can create an object like this:

$inbox  = new Teamwork\Desk\Inbox();
$ticket = new Teamwork\Desk\Ticket();
$ticket->customerEmail = '';
$ticket->subject       = 'Server on fire!';
$ticket->message       = 'The server is actually on fire!';
$ticket->priority      = 'High';
$ticket->inboxId       = $inbox->getByName('Server Stuff');