Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ $client->contacts->deleteContact('570680a8a1bcbca8a90001b9');
/** Get a contact by ID */
$client->contacts->getContact('570680a8a1bcbca8a90001b9');

/** Merge a contact to a User */
$client->contacts->mergeContact([
'from' => '570680a8a1bcbca8a90001b9',
'into' => '59c124f770e00fd819b9ce81',
]);

/** Search for contacts */
$query = ['field' => 'name', 'operator' => '=', 'value' => 'Alice'];
$client->contacts->search([
Expand Down
13 changes: 13 additions & 0 deletions src/IntercomContacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ public function deleteContact(string $id, array $options = [])
return $this->client->delete($path, $options);
}

/**
* Merge a contact to a User.
*
* @see https://developers.intercom.com/intercom-api-reference/reference#merge-contact
* @param array $options
* @return stdClass
* @throws Exception
*/
public function mergeContact(array $options)
{
return $this->client->post("contacts/merge", $options);
}

/**
* Returns list of Contacts that match search query.
*
Expand Down
8 changes: 8 additions & 0 deletions tests/IntercomContactsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public function testContactDelete()
$this->assertSame('foo', $contacts->deleteContact(''));
}

public function testContactMerge()
{
$this->client->method('post')->willReturn('foo');

$contacts = new IntercomContacts($this->client);
$this->assertSame('foo', $contacts->mergeContact([]));
}

public function testContactSearch()
{
$this->client->method('post')->willReturn('foo');
Expand Down