Skip to content

Commit 23a5a39

Browse files
committed
Merge pull request #194 from intercom/RuairiK/add_attachment_support
Add attachment support
2 parents 83731d1 + 96817a2 commit 23a5a39

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ conversation.conversation_parts[1].body
177177
intercom.conversations.reply(:id => conversation.id, :type => 'user', :email => '[email protected]', :message_type => 'comment', :body => 'foo')
178178
# Admin (identified by id) replies with a comment
179179
intercom.conversations.reply(:id => conversation.id, :type => 'admin', :admin_id => '123', :message_type => 'comment', :body => 'bar')
180+
# User (identified by email) replies with a comment and attachment
181+
intercom.conversations.reply(:id => conversation.id, :type => 'user', :email => '[email protected]', :message_type => 'comment', :body => 'foo', :attachment => ['http://www.example.com/attachment.jpg'])
180182

181183
# Open
182184
intercom.conversations.open(id: conversation.id, admin_id: '123')

spec/unit/intercom/conversation_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
client.conversations.reply(id: '147', type: 'user', body: 'Thanks again', message_type: 'comment', user_id: 'ac4')
1919
end
2020

21+
it 'replies to a conversation with an attachment' do
22+
client.expects(:post).with('/conversations/147/reply', { type: 'user', body: 'Thanks again', message_type: 'comment', user_id: 'ac4', conversation_id: '147', attachment_urls: ["http://www.example.com/attachment.jpg"] }).returns(test_conversation)
23+
client.conversations.reply(id: '147', type: 'user', body: 'Thanks again', message_type: 'comment', user_id: 'ac4', attachment_urls: ["http://www.example.com/attachment.jpg"])
24+
end
25+
2126
it 'opens a conversation' do
2227
client.expects(:post).with('/conversations/147/reply', { type: 'admin', message_type: 'open', conversation_id: '147', admin_id: '123'}).returns(test_conversation)
2328
client.conversations.open(id: '147', admin_id: '123')

0 commit comments

Comments
 (0)