This is the PHP SDK to the HelpSpot API. The SDK can work with both the public and private (staff) API.
Please read the full documentation for each API method here:
- API Overview
- Public API Methods - Access as the customer
- Private API Methods - Access as a staff person with a HelpSpot license
Via Composer
$ composer require helpspot/helpspotIf your framework handles autoloading you can simply use a use statement at the top of your php file to access HelpSpot. If it doesn't, you can load in HelpSpot with the require statement shown below plus using the use statement at the top of the file you want to access HelpSpot in.
require_once "vendor/autoload.php";
use helpspot\helpspot\helpspot;
// Access HelpSpot in your functions and methods in this fileYou can authenticate either via an api key or a username and password combination. The API key is now the recommended authentication method and is the only method available if the HelpSpot instance uses SAML or LDAP authentication.
API Key:
$helpspot = new helpspot('https://company.helpspot.com', '', '','apikey');Username Password:
$helpspot = new helpspot('https://company.helpspot.com', 'user@example.com', 'password');$helpspot = new helpspot('https://company.helpspot.com', 'user@example.com', 'password');
$helpspot->post('private.request.create', [
'sEmail' => 'customer@company.com',
'tNote' => 'testing',
'xCategory' => 1
]);$helpspot = new helpspot('https://company.helpspot.com', 'user@example.com', 'password');
$helpspot->post('private.request.update', [
'xRequest' => 12400,
'fNoteType' => 1, // A public note
'tNote' => 'Update the request with this note.',
]);$helpspot = new helpspot('https://company.helpspot.com', 'user@example.com', 'password');
$request = $helpspot->get('private.request.get', [
'xRequest' => 12400
]);
echo $request->sEmail;$helpspot = new helpspot('https://company.helpspot.com');
$helpspot->post('request.create', [
'sEmail' => 'customer@company.com',
'tNote' => 'testing'
]);$helpspot = new helpspot('https://company.helpspot.com', 'user@example.com', 'password');
$request = $helpspot->get('private.request.get', [
'xRequest' => 12400
]);
if($helpspot->hasError())
{
foreach($helpspot->getErrors() as $error)
{
echo $error->id .' '. $error->description;
}
}
else
{
echo $request->sEmail;
}If you discover any security related issues, please email customer.service@userscape.com instead of using the issue tracker.
- UserScape Inc.
The MIT License (MIT). Please see License File for more information.