-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contact & Conversation Tagging / Articles / Messages #314
base: master
Are you sure you want to change the base?
Changes from 1 commit
8a5d433
12cf8ae
42b9d6a
19a20b3
8f34502
0d972de
b0a1b61
2b613bd
cbb6bab
d52084e
c752909
966ab4a
3adef45
c73965c
9a1fdea
074574f
217e059
64a24e5
ef7029e
ddda8f6
760ffca
494c770
7c5bc59
5a1d17f
52a8dab
f748109
eaa8f78
de1ed0d
fd620d1
e8fc1be
027baf1
484a7d8
14f8bfa
af555c6
d5ca224
2bd694d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -90,6 +90,12 @@ $client->contacts->nextSearch($query, $response->pages); | |||||||||||||||||||
|
||||||||||||||||||||
/** List all contacts */ | ||||||||||||||||||||
$client->contacts->getContacts([]); | ||||||||||||||||||||
|
||||||||||||||||||||
/** Tag a Contact */ | ||||||||||||||||||||
$client->contacts->addTag("570680a8a1bcbca8a90001b9", "2084335"); | ||||||||||||||||||||
|
||||||||||||||||||||
/** Remove a Tag from a Contact */ | ||||||||||||||||||||
$client->contacts->removeTag("570680a8a1bcbca8a90001b9", "2084335"); | ||||||||||||||||||||
``` | ||||||||||||||||||||
|
||||||||||||||||||||
## Users | ||||||||||||||||||||
|
@@ -489,6 +495,25 @@ $client->teams->getTeams(); | |||||||||||||||||||
$client->teams->getTeam("1188"); | ||||||||||||||||||||
``` | ||||||||||||||||||||
|
||||||||||||||||||||
## Articles | ||||||||||||||||||||
|
||||||||||||||||||||
```php | ||||||||||||||||||||
/** Create an Article */ | ||||||||||||||||||||
$client->articles->create(["title" => "How To Use the Intercom API", "description" => "A quick guide to the universe of the Intercom API", "body" => "<p>This is the body in html</p>", "author_id" => 1]); | ||||||||||||||||||||
|
||||||||||||||||||||
/** Retrieve an Article */ | ||||||||||||||||||||
$client->articles->getArticle("123456"); | ||||||||||||||||||||
|
||||||||||||||||||||
/** Update an Article */ | ||||||||||||||||||||
$client->articles->update("123456", ["title" => "How To Use the Intercom API", "description" => "A quick guide to the universe of the Intercom API", "body" => "<p>This is the body in html</p>"); | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here 😃
Suggested change
|
||||||||||||||||||||
|
||||||||||||||||||||
/** Delete an Article */ | ||||||||||||||||||||
$client->articles->deleteArticle("123456"); | ||||||||||||||||||||
|
||||||||||||||||||||
/** List Articles */ | ||||||||||||||||||||
$client->articles->getArticles(); | ||||||||||||||||||||
``` | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
## Rate Limits | ||||||||||||||||||||
|
||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,6 @@ public function create(array $options) | |
} | ||
|
||
/** | ||
* Updates a Contact. | ||
* | ||
* @see https://developers.intercom.com/intercom-api-reference/reference#update-contact | ||
* @param string $id | ||
* Updates an existing Contact | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems these lines are a bit off 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Woops. Fixing |
||
* | ||
* @see https://developers.intercom.com/intercom-api-reference/reference#update-contact | ||
|
@@ -63,7 +59,7 @@ public function getContacts(array $options = []) | |
* @throws Exception | ||
*/ | ||
|
||
public function getContact($id, $options = []) | ||
public function getContact(string $id, array $options = []) | ||
{ | ||
$path = $this->contactPath($id); | ||
return $this->client->get($path, $options); | ||
|
@@ -89,31 +85,31 @@ public function deleteContact(string $id, array $options = []) | |
* | ||
* @see https://developers.intercom.com/intercom-api-reference/reference#tag-contact | ||
* @param string $id | ||
* @param string $tag_id | ||
* @param string $tagId | ||
* @return stdClass | ||
* @throws Exception | ||
*/ | ||
public function addTag(string $id, string $tag_id) | ||
public function addTag(string $id, string $tagId) | ||
{ | ||
$path = $this->contactPath($id); | ||
$path = $this->contactTagsPath($id); | ||
|
||
return $this->client->post($path.'/tags', ['id' => $tag_id]); | ||
return $this->client->post($path, ['id' => $tagId]); | ||
} | ||
|
||
/** | ||
* Removes a tag from a Contact based on the provided Tag ID | ||
* | ||
* @see https://developers.intercom.com/intercom-api-reference/reference#untag-contact | ||
* @param string $id | ||
* @param string $tag_id | ||
* @param string $tagId | ||
* @return stdClass | ||
* @throws Exception | ||
*/ | ||
public function removeTag(string $id, string $tag_id) | ||
public function removeTag(string $id, string $tagId) | ||
{ | ||
$path = $this->contactPath($id); | ||
$path = $this->contactTagsPath($id); | ||
|
||
return $this->client->delete($path.'/tags', ['id' => $tag_id]); | ||
return $this->client->delete($path, ['id' => $tagId]); | ||
} | ||
|
||
/** | ||
|
@@ -168,4 +164,15 @@ public function contactPath(string $id) | |
{ | ||
return 'contacts/' . $id; | ||
} | ||
|
||
/** | ||
* Returns the path for adding/removing a tag for a given contact | ||
* | ||
* @param string $id Contact ID | ||
* @return string | ||
*/ | ||
public function contactTagsPath(string $id) | ||
{ | ||
return 'contacts/' . $id . '/tags'; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love to split this into multiple lines: