Skip to content

Commit 99de0c2

Browse files
committed
add admin convo replies and fix up some user replies
1 parent b061353 commit 99de0c2

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

src/Intercom/Service/config/intercom_public_conversation.json

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,39 @@
144144
"required": true,
145145
"type": "string"
146146
},
147+
"intercom_user_id": {
148+
"location": "json",
149+
"required": false,
150+
"type": "string"
151+
},
152+
"user_id": {
153+
"location": "json",
154+
"required": false,
155+
"type": "string"
156+
},
147157
"email": {
148158
"location": "json",
149159
"required": false,
150160
"type": "string"
151161
},
162+
"admin_id": {
163+
"location": "json",
164+
"required": false,
165+
"type": "string"
166+
},
152167
"type": {
153-
"default": "json",
154-
"location": "query",
168+
"location": "json",
155169
"required": true,
156-
"static": true
170+
"type": "string"
157171
},
158172
"body": {
159173
"location": "json",
160-
"required": false,
174+
"required": true,
161175
"type": "string"
162176
},
163177
"message_type": {
164178
"location": "json",
165-
"required": false,
179+
"required": true,
166180
"type": "string"
167181
}
168182
},

tests/Intercom/Resources/ConversationTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,17 @@ public function testGetAdminConversations()
7777
public function testReplyToConversation()
7878
{
7979
$this->setMockResponse($this->client, 'Conversation/Conversation.txt');
80-
$this->client->replyToConversation(['id' => '123456']);
80+
$this->client->replyToConversation(['id' => '123456', 'user_id' => '45', 'type' => 'user', 'message_type' => 'comment', 'body' => 'my reply']);
8181

82-
$this->assertRequest('POST', '/conversations/123456/reply?type=json');
82+
$this->assertRequest('POST', '/conversations/123456/reply');
83+
$this->assertRequestJson(['user_id' => '45', 'type' => 'user', 'body' => 'my reply', 'message_type' => 'comment']);
84+
}
85+
86+
public function testReplyToConversationAsAdmin() {
87+
$this->setMockResponse($this->client, 'Conversation/Conversation.txt');
88+
$this->client->replyToConversation(['id' => '123456', 'admin_id' => '6', 'type' => 'admin', 'message_type' => 'comment', 'body' => 'my reply']);
89+
$this->assertRequest('POST', '/conversations/123456/reply');
90+
$this->assertRequestJson(['admin_id' => '6', 'type' => 'admin', 'body' => 'my reply', 'message_type' => 'comment']);
8391
}
8492

8593
public function testMarkConversationAsRead()
@@ -113,4 +121,4 @@ public function testMarkConversationAsReadNoID()
113121
{
114122
$this->client->markConversationAsRead();
115123
}
116-
}
124+
}

0 commit comments

Comments
 (0)