Skip to content

Commit

Permalink
Updated README and CHANGELOG for the 1.8.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenwadejr committed Feb 19, 2016
1 parent 6eaeb3c commit 95764ad
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#### 1.8.0 (February 19, 2016)
* Added support for Custom Fields returned within a Mailbox details
* Added support for Custom Field Responses returned with a Conversation

#### 1.7.0 (February 2, 2016)
* Deprecated "Team" reports. With the arrival of "Teams" with the new Plus Plan, the previous "Team" report has been renamed "Company" report
* Added new reports methods: `getCompanyReport`, `getCustomersHelpedCompanyReport`, `getCompanyDrillDownReport`
Expand Down
88 changes: 86 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Help Scout PHP Wrapper [![Build Status](https://travis-ci.org/helpscout/helpscou
================================================================================
> PHP Wrapper for the Help Scout API and Webhooks implementation. More information on our [developer site](http://developer.helpscout.net).
Version 1.7.0 Released
Version 1.8.0 Released
---------------------
Please see the [Changelog](https://github.com/helpscout/helpscout-api-php/blob/master/CHANGELOG.md) for details.

Expand Down Expand Up @@ -244,6 +244,91 @@ if ($webhook->isValid()) {
}
```

Example Usage: Custom Fields
------------------------

### Retrieving custom fields for a mailbox

```php
include 'HelpScout/ApiClient.php';

use HelpScout\ApiClient;

$scout = ApiClient::getInstance();
$scout->setKey('your-api-key-here');

$mailbox = $scout->getMailbox(1234);
$customFields = $mailbox->getCustomFields();
```

### Retrieving custom fields with responses for a conversation

```php
$conversation = $scout->getConversation(1234);
$customFields = $conversation->getCustomFields();

```

### Filling in a value for a field on a conversation that hasn't been filled out yet

This is if the conversation hasn't had **any** fields filled out yet

```php
$conversation = $scout->getConversation(1234);
$mailbox = $scout->getMailbox($conversation->getMailbox()->getId());

$conversationFields = [];

foreach ($mailbox->getCustomFields() as $customField) {
if ($customField->getId() == 88) {
$field = clone $customField;
$field->setValue('Foo');
$conversationFields[] = $field;
}
}

$conversation->setCustomFields($conversationFields);

$scout->updateConversation($conversation);
```

### Updating a value for a field on a conversation

```php
$conversation = $scout->getConversation(1234);

foreach ($conversation->getCustomFields() as $customField) {
if ($customField->getId() == 88) {
$field->setValue('Bar');
}
}

$scout->updateConversation($conversation);
```

### Custom Field Validation

#### Date Fields (`DateFieldRef`)

Must be a valid date in the format of YYYY-MM-DD (year-month-day).

#### Dropdown Fields (`DropdownFieldRef`)

The value must be the ID of one of the available dropdown options.

#### Multi Line Fields (`MultiLineFieldRef`)

The maximum string length for a multi line value is 15000 characters.

#### Number Fields (`NumberFieldRef`)

Number values must be numeric. Integers and Decimals (floats) are allowed (ex: 100 or 12.34).

#### Single Line Fields (`SingleLineFieldRef`)

The maximum string length for a single line value is 255 characters.


Debugging
------------------------

Expand Down Expand Up @@ -285,7 +370,6 @@ try {
That outputs

```php
Input could not be validated
Array
(
[0] => Array
Expand Down

0 comments on commit 95764ad

Please sign in to comment.