intercom/intercom-ruby

Creating a conversation doesn't return the conversation ID in the returning message object

shobhitic opened this issue · 1 comments

Version info

  • intercom-ruby version: 4.1.1
  • Ruby version: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]

Expected behavior

When I create a new conversation or a message, the resulting message response should have a conversation ID.

Actual behavior

The returning Intercom::Message and Intercom::Conversation message don't have a conversation_id even though they are creating a new conversation. The ID method on Intercom::Conversation returns the message ID and not conversation ID.

Steps to reproduce

INTERCOM = Intercom::Client.new(token: Rails.application.secrets.intercom_access_token)

message = INTERCOM.messages.create({
  message_type: 'inapp',
  body: "SOME BODY",
  from: {
    type: 'admin',
    id: intercom_uid
  },
  to: {
    type: 'contact',
    id: other_intercom_uid
  }
})

message.id # message ID.
message.conversation_id # throws error

conversation = INTERCOM.conversations.create({
  message_type: 'inapp',
  body: "SOME BODY",
  from: {
    type: 'admin',
    id: intercom_uid
  },
  to: {
    type: 'contact',
    id: other_intercom_uid
  }
})

conversation.id # message ID.
conversation.conversation_id # throws error

Logs

None

👋 This is currently expected behavior - if you start a conversation from an admin, we won't return a conversation_id associated with the message, as shown in the example response documented here:

https://developers.intercom.com/intercom-api-reference/reference#admin-initiated-conversation

Feel free to write into our messenger at intercom.com, if you have any specific questions about this.