cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1316
Views
1
Helpful
6
Replies

Service App API

alexvelt
Level 1
Level 1

Hey,

I'm trying to create a service app for my organization to list & read messages from users. When using the API in the developer portal the call to "https://webexapis.com/v1/messages?roomId=ID"  returns a list of messages for that room. But the same call in service app returns a "message not found" result.

 
I am able to see a call from the service app if I provide the message id in the API ex .https://webexapis.com/v1/messages/ID
 
Is there a different call to list all (direct) messages for a specific user when using a service app?
1 Accepted Solution

You can only list all messages for spaces that you are in. Service Apps are their own machine account and don't act on behalf of the user that authorizes it like an integration does so unless you add the SA to the space it won't be able to list all messages. With the compliance scope you can only get specific message details. The CO role is meant to be used to poll the /events API and then get details of specific messages, memberships, etc...

You can add the SA to a space using the /memberships API but you'll need to get the personId for the SA first, which can be obtained by querying /people/me with the SA token as long as it has the spark:people_read scope. Once the SA is in the space then it would be able to list all messages with the user level scope spark:messages_read.

View solution in original post

6 Replies 6

Janos Benyovszki
Cisco Employee
Cisco Employee

Thanks. Please note, that even with a Compliance Officer, you will not be able to list all messages in a space. But you will be able to read individual messages. If you use the Events API https://developer.webex.com/docs/api/v1/events/list-events to get a message ID, can you then read that message using https://developer.webex.com/docs/api/v1/messages/get-message-details ? 

Janos Benyovszki
Cisco Employee
Cisco Employee

@alexvelt does the Service App has Compliance Officer scopes, namely spark-compliance:messages_read and was the SA approved by a Compliance Officer in Control Hub?

Yes, The Service App has "spark-compliance:messages_read" and the Control Hub role used to approve has "advanced troubleshooting, Compliance officer, Full admin, User, Webex site admin, atlasRoles.WXC_Cdr_Rest_ReadOrgRole"

 

You can only list all messages for spaces that you are in. Service Apps are their own machine account and don't act on behalf of the user that authorizes it like an integration does so unless you add the SA to the space it won't be able to list all messages. With the compliance scope you can only get specific message details. The CO role is meant to be used to poll the /events API and then get details of specific messages, memberships, etc...

You can add the SA to a space using the /memberships API but you'll need to get the personId for the SA first, which can be obtained by querying /people/me with the SA token as long as it has the spark:people_read scope. Once the SA is in the space then it would be able to list all messages with the user level scope spark:messages_read.

Hey Jeff,

Just to follow up on this is there a way to add the service app to a 1:1 / direct conversation. If not is there any way to read a 1:1 conversation with the compliance officer role?

A 1:1 space can only have two participants so there would be no way to add another user or SA to a existing 1:1 space to be able to read all messages in the space. With the CO role you'd need to get all of the message events from the /events API. The message events do contain the message content so there would be no need to make additional queries. You can just pull all message events into a database or something and then filter them on your end by roomId to see all messages in a 1:1 space.