function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
eyal83eyal83 

how to get complete conversations

Hello,

I am trying to get a complete conversation between 2 users which was sent through private messages. The problem is, that for some reason, I am only able to get the last message which was send and not the whole conversation. Example:

 

The messages:

 

1. first message

2. reply

3. blah

4. kuku

 

when I send the rest querry I am getting:

{"id"=>"03M70000000CfweEAC", "url"=>"/services/data/v23.0/chatter/users/me/conversations/03M70000000CfweEAC", "members"=>[{"name"=>"Eyal Eizenberg", "title"=>nil, "firstName"=>"Eyal", "lastName"=>"Eizenberg", "companyName"=>nil, "mySubscription"=>nil, "photo"=>{"smallPhotoUrl"=>"https://c.na5.content.force.com/profilephoto/729700000004fkK/T", "largePhotoUrl"=>"https://c.na5.content.force.com/profilephoto/729700000004fkK/F"}, "isChatterGuest"=>false, "id"=>"00570000001YGwlAAG", "type"=>"User", "url"=>"/services/data/v23.0/chatter/users/00570000001YGwlAAG"}, {"name"=>"IT SAManageIT", "title"=>nil, "firstName"=>"IT", "lastName"=>"SAManageIT", "companyName"=>nil, "mySubscription"=>nil, "photo"=>{"smallPhotoUrl"=>"https://c.na5.content.force.com/profilephoto/005/T", "largePhotoUrl"=>"https://c.na5.content.force.com/profilephoto/005/F"}, "isChatterGuest"=>false, "id"=>"00570000001YihcAAC", "type"=>"User", "url"=>"/services/data/v23.0/chatter/users/00570000001YihcAAC"}], "read"=>true, "latestMessage"=>{"id"=>"03J70000000ChbTEAS", "sender"=>{"name"=>"IT SAManageIT", "title"=>nil, "firstName"=>"IT", "lastName"=>"SAManageIT", "companyName"=>nil, "mySubscription"=>nil, "photo"=>{"smallPhotoUrl"=>"https://c.na5.content.force.com/profilephoto/005/T", "largePhotoUrl"=>"https://c.na5.content.force.com/profilephoto/005/F"}, "isChatterGuest"=>false, "id"=>"00570000001YihcAAC", "type"=>"User", "url"=>"/services/data/v23.0/chatter/users/00570000001YihcAAC"}, "url"=>"/services/data/v23.0/chatter/users/me/messages/03J70000000ChbTEAS", "body"=>{"text"=>"kuku", "messageSegments"=>[]}, "recipients"=>[], "sentDate"=>"2012-01-26T15:32:28.000Z", "conversationId"=>"03M70000000CfweEAC", "conversationUrl"=>"/services/data/v23.0/chatter/users/me/conversations/03M70000000CfweEAC"}}

 

 

As you can see I am only getting "kuku" but not the rest of the messages. How can I get all of them?

 

Thanks!

 

 

dsinghdsingh

Hi,

 

I am not sure on which URL you are making the REST call. If you can try to make a REST call on the following URL and see if it returns the full conversation. I have tried the same in my dev org and it works as expected.

 

/services/data/v23.0/chatter/users/me/conversations/03M70000000CfweEAC

 

--

dv

eyal83eyal83

Well, if I use the same call like you (going specifically to that conversation's id) I can get the whole conversation. But why can't I access the whole conversation by calling all the conversations? It seems kind of weird.

 

These are the keys which are available by calling all the conversations and then going into the first one:

 

(rdb:1) response['conversations'][0].keys
["id", "url", "members", "read", "latestMessage"]

 

 

And these are the ones if I call the specific conversation like dsingh suggested:

 

(rdb:1) response.keys
["messages", "members", "read", "conversationId", "conversationUrl"]

 

Then by going into messages I can get the whole conversation.

 

Seems odd though that you can't get "messages" by using the first method.

 

Any suggestions on that?

dsinghdsingh

Well, I think thats the way its designed. If you query all the conversations, it returns only latest message of every conversation and returns full conversation with specific conversation ID.

 

Sorry, I am not aware of any other way.

 

--

dv