Skip to content

Commit 5014dce

Browse files
committed
display_as option for Conversations
1 parent e119f6c commit 5014dce

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ $intercom->getConversations(array(
269269
"id" => "7",
270270
"open" => true
271271
));
272+
// Get all open conversations assigned to an admin and render as plaintext
273+
$intercom->getConversations(array(
274+
"type" => "admin",
275+
"id" => "7",
276+
"open" => true,
277+
"display_as" => "plaintext"
278+
));
272279
// Get all closed conversations assigned to an admin
273280
$intercom->getConversations(array(
274281
"type" => "admin",

src/Intercom/Service/config/intercom_public_conversation.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
"location": "uri",
8585
"required": true,
8686
"type": "string"
87+
},
88+
"display_as": {
89+
"location": "query",
90+
"required": false,
91+
"type": "string"
8792
}
8893
},
8994
"responseClass": "ConversationModel",
@@ -129,6 +134,11 @@
129134
"location": "query",
130135
"required": false,
131136
"type": "boolean"
137+
},
138+
"display_as": {
139+
"location": "query",
140+
"required": false,
141+
"type": "string"
132142
}
133143
},
134144
"responseClass": "ConversationListModel",

tests/Intercom/Resources/ConversationTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ public function testGetConversation()
4141
$this->assertEquals(true, $response['open']);
4242
}
4343

44+
public function testGetConversationWithDisplayAs()
45+
{
46+
$this->setMockResponse($this->client, 'Conversation/Conversation.txt');
47+
$response = $this->client->getConversation(['id' => '123456', 'display_as' => 'plaintext']);
48+
49+
$this->assertRequest('GET', '/conversations/123456?display_as=plaintext');
50+
51+
$this->assertInstanceOf('\Guzzle\Service\Resource\Model', $response);
52+
$this->assertEquals('25', $response['conversation_message']['author']['id']);
53+
$this->assertEquals(true, $response['open']);
54+
}
55+
4456
public function testGetAllConversations()
4557
{
4658
$this->setMockResponse($this->client, 'Conversation/ConversationList.txt');
@@ -74,6 +86,15 @@ public function testGetAdminConversations()
7486
$this->assertRequest('GET', '/conversations?type=admin');
7587
}
7688

89+
public function testGetAdminConversationsWithDisplayAs()
90+
{
91+
$this->setMockResponse($this->client, 'Conversation/ConversationList.txt');
92+
$response = $this->client->getConversations(['type' => 'admin', 'display_as' => 'plaintext']);
93+
$conversations = $response->get('conversations');
94+
95+
$this->assertRequest('GET', '/conversations?type=admin&display_as=plaintext');
96+
}
97+
7798
public function testReplyToConversation()
7899
{
79100
$this->setMockResponse($this->client, 'Conversation/Conversation.txt');

0 commit comments

Comments
 (0)