cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
712
Views
0
Helpful
10
Replies

webex API integration

demule
Cisco Employee
Cisco Employee

I am trying to fetch messages from my webex room. Those messages should be in given date range. EX. I want to fetch all the messages we got in a day. I provided the date range but its not working as expected, I could see messages for 3-4 days. I am using below API.

 

String apiUrl = "https://webexapis.com/v1/messages";
String queryParams = "?roomId=" + "id" +
"&created=" + fromDate + "-" + toDate;
1 Accepted Solution

If the before and beforeMessage params don't suit, then the only other option is to pull all messages on your side and write a script to go through the "created" field that's returned for each message in the response so you can pull whichever messages within a date range that you want to get.

View solution in original post

10 Replies 10

demule
Cisco Employee
Cisco Employee
String parentId = message.getParentId();

This is the way I am trying to retrieve parentId 

What is "message" in this case (its value) and what is the definition of getParentId() function? In other words, what is the code for that function?

Are you using an SDK maybe? If so, which one?

If a message's parentId is null, that should indicate it is either the root message of a thread or not threaded at all.  It is not possible to directly query for the opposite relationship, i.e. the child/children messages for a particular message - you would need to retrieve all messages then construct a graph of parent/child relationships to get a complete picture.
If you are seeing a message that is definitely a reply, but that has no parentId, I think that would be unexpected - might want to open a support ticket so the Webex dev support folks can investigate the message in question and peek into any helpful logs (be sure to have a transaction Id from an API response handy.)  I'm not sure what happens to a message's parentId if the parent message is deleted and/or the message sender leaves the organization - could be a valid scenario.
This sample may be helfpul as it does both date-range message selection and thread reconstruction: https://github.com/CiscoDevNet/webex-messaging-activity-report-sample

demule
Cisco Employee
Cisco Employee

I am getting parentId null even if the message is a reply to another message

 

demule
Cisco Employee
Cisco Employee

I mean, I want to find out if the message is part of some message thread or is a new message. All this using API

demule
Cisco Employee
Cisco Employee

How can I find replies for message in webex room using API

The list message endpoint has a query parameter parentId. It points to the parent message.

Same in the response. If it's empty, it is a thread's root.

demule
Cisco Employee
Cisco Employee

Then how can I get the messages arrived in particular date range. before param will not give the required time range messages

If the before and beforeMessage params don't suit, then the only other option is to pull all messages on your side and write a script to go through the "created" field that's returned for each message in the response so you can pull whichever messages within a date range that you want to get.

Raffaele Lagana
Cisco Employee
Cisco Employee

The /messages API you're using doesn't have a "created" parameter. Please see here for what it does have: https://developer.webex.com/docs/api/v1/messages/list-messages.