Skip to content

Commit b7a5e12

Browse files
committed
wip assign/open/close
1 parent a8c5295 commit b7a5e12

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,18 @@ intercom.conversations.reply(:id => conversation.id, :type => 'user', :email =>
178178
# Admin (identified by email) replies with a comment
179179
intercom.conversations.reply(:id => conversation.id, :type => 'admin', :email => '[email protected]', :message_type => 'comment', :body => 'bar')
180180

181+
# Reply and Open
182+
intercom.conversations.reply_and_open(:id => conversation.id, :type => 'admin', :email => '[email protected]', :message_type => 'note', :body => 'foo')
183+
184+
# Reply and Close
185+
intercom.conversations.reply_and_close(:id => conversation.id, :type => 'admin', :email => '[email protected]', :message_type => 'note', :body => 'foo')
186+
187+
# Reply and Assign
188+
intercom.conversations.reply_and_assign({:id => conversation.id, :type => 'admin', :email => '[email protected]', :message_type => 'note', :body => 'foo'}, assignee_id: admin.id)
189+
190+
# Assign without reply
191+
intercom.conversations.assign({:id => conversation.id }, assignee_id: admin.id)
192+
181193
# MARKING A CONVERSATION AS READ
182194
intercom.conversations.mark_read(conversation.id)
183195
```

lib/intercom/service/conversation.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ def reply(reply_data)
2626
response = @client.post("/#{collection_name}/#{id}/reply", reply_data.merge(:conversation_id => id))
2727
collection_class.new.from_response(response)
2828
end
29-
end
29+
30+
def reply_and_open(reply_data)
31+
reply reply_data.merge(change_state: 'open')
32+
end
33+
34+
def reply_and_close(reply_data)
35+
reply reply_data.merge(change_state: 'close')
36+
end
37+
38+
def reply_and_assign(reply_data, assignee_id:)
39+
reply reply_data.merge(assignee_id: assignee_id)
40+
end
41+
42+
def assign(reply_data, assignee_id:)
43+
reply reply_data.merge(message_type: 'assignment', assignee_id: assignee_id)
44+
end
3045
end
3146
end

0 commit comments

Comments
 (0)