Not authorized for API access when getting invites
Hi there,
My bot is able to login, retrieve the WS stream, establish a WS connection and receive messages posted on the web eikonmessenger. It also receive chat room invitations such as "{"event":"chatroomInvite","invite":{"chatroomId":"xxxx","chatroomType":"chatroom","from":{"email":"xxxx","company":"xxxx"},"status":"pending"}}".
Questions:
- Does the bot need to accept those invitations to start receiving messages? Or does it join automatically the chatrooms when invited? I noticed this endpoint in your postman example: "/messenger/beta1/chatrooms/invites" but there is no mention of it in the documentation.
- When calling "messenger/beta1/chatrooms/invites" from postman or java, an error is received indicating that the bot the is unauthorized despite the login and WS stream requests being successfull. Would you know what is the problem? Happy to provide the bot id in private if needed.
Thank you for your help
Best Answer
-
Hello @kevin.deville
Based on the bot team investigation, the bot username should contain "bot_agent" special prefix, but your bot email has a different pattern.
Please contact dino.diviacchi@lseg.com to verify your bot account.
0
Answers
-
Hello @kevin.deville
Thank you for contacting us. Please see my answer below:
Question 1: Does the bot need to accept those invitations to start receiving messages? Or does it join automatically?
Answer: I am checking with the Messenger Bot team and I will get back to you.
Question 2: When calling "messenger/beta1/chatrooms/invites" from postman or java, an error is received indicating that the bot is unauthorized despite the login and WS stream request being successful.
Answer: Do you mean the Messenger Bot REST API https://api.refinitiv.com/messenger/beta1/chatrooms/{
{chatroomId}}/invite endpoint? If so, you need to send the access token (STS Token) with the HTTP request header to confirm authentication grants as follows:POST /messenger/beta1/chatrooms/{
{chatroomId}}/invite HTTP/1.1
Host: api.refinitiv.com
Accept: application/json
Authorization: Bearer <Access Token>
Content-Type: application/json
Content-Length: 63
{
"emails": ["user@domain.com"]
}Note: Please be noticed "a space" between "Bearer" and <Access Token>.
Based on your "despite the login and WS stream requests being successful" message, it means you already get the Access Token and connect to the WebSocket Server somewhere else. Am I correct?
If so, you need to re-authentication with RDP API Auth Service (https://api.refinitiv.com/auth/oauth2/v1/token) on Postman or Java to get the access token first. Otherwise, you need to copy the access token and set it to the Postman or the Java app.
0 -
Thanks wasin for the quick answer
No I mean:
https://{
{URL}}/messenger/beta1/chatrooms/invitesBut maybe this is only for BLC and not managed chats. Will wait for your answer on question 1 then.
Note that this is the only endpoint I could find in your postman example while trying to find a way to accept the invites. The shown status of the invites I receive is pending and I don't receive messages. I couldn't find any information in the documentation.
I'm able to get the STS token and pass it in the header using Bearer yes. Similarly to the Get WS Stream request basically.
0 -
any luck please? thank you0
-
Hi @kevin.deville
Sorry for the late reply, I am still waiting information from the Messenger Bot API team.
0 -
Hello @kevin.deville
Sorry for the late reply. The Messenger Bot team confirms the bot can accept the invitation and join that chatroom using a Join chatroom HTTP command as follows:
curl --location --request POST 'https://api.refinitiv.com/messenger/beta1/chatrooms/<chatroomId>/join'; \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data ''The success response body is like this:
{
"member": {
"email": <bot email>,
"affiliation": "admin",
"role": "moderator"
}
}I hope this helps.
0 -
Thanks Wasin. So, if the invitations need to be explicitly accepted, how can the bot retrieve the list of pending ones and associated chat room ids? As mentioned, I tried different end points but always getting unauthorized error (e.g. https://api.refinitiv.com/messenger/beta1/managed_chatrooms, https://api.refinitiv.com/messenger/beta1/chatrooms, /messenger/beta1/chatrooms/invites).
Thank you!
0 -
Hello @kevin.deville
According to the Messenger Bot team, Bot could get all available invitations from others through the following REST API call:
curl --location --request GET 'https://api.refinitiv.com/messenger/beta1/chatrooms/invites'; \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <Access Token>'Could you please clarify the issue?
Do you mean you got an unauthorized error from the API call above?
Or
You can get the list of invite rooms successfully, but when you call HTTP Post <chatroomId>/join, you got an unauthorized error.
It would be nice if you can share the full response/error message from the API call
By the way, please confirm if you are using the managed or bilateral chatroom.
0 -
Sure, let me recap:
Using the bot API, I am able to login, retrieve the WS stream, establish a WS connection and receive messages posted on the web eikonmessenger (i.e. https://collab.platform.refinitiv.com/eikonmessenger).
In the logs, I noticed the bot received chat room invitations such as ""event":"chatroomInvite","invite":{"chatroomId":"xxxx","chatroomType":"chatroom","from":{"email":"xxxx","company":"xxxx"},"status":"pending"}}".I am therefore trying to find a way for the bot to join these chat rooms as the bot does not seem to accept them automatically and receive messages. The received chatroomInvite mesages do not indicate the type of room (managed or bilateral) and are now x days old.
I therefore need a way to retrieve the list of room ids for which invitations have been sent and are pending.
I did try the endpoint you are mentioning above as mentioned in my initial post
/messenger/beta1/chatrooms/invites
but was always getting the same error indicating that the bot the is unauthorized.
I confirm I am using the same curl script as above. I also tried via Postman using the provided example.
Could this be a scope issue for the bot account I am using?
Note that today the bot seems to have exceeded the API limit as I receive a "Too many requests" error. However, there is no information regarding the API limits in the bot API documentation so I have no idea how long I will have to wait for the bot to be active again.
Thank you for your help
0 -
Hello @kevin.deville
Thank you very much for the detailed description. I am understanding the scenario now.
Getting a Chat room invites
I am contacting the Messenger Bot team. I will get back to you as soon as I receive any information from them.
API Limit
The Messenger Bot API REST interface has the following usage limits:
- /chatrooms/{chatroomId}/join endpoint: 2 requests per second
- Other endpoints (example: /chatrooms/{ chatroomId }/post, etc.): 1 request per second
The usage limit is for protecting the backend from being overloaded.
0 -
Hello @kevin.deville
The Messenger Bot team is checking the issue. In the meantime, please confirm the following information:
- The bot application sends a valid and non-expired sts token with the /chatrooms/invites API call
- Does the sts token you send in (#1) the same as the one bot login to the WebSocket?
So, can I assume that your steps are as follows?
- bot login to RDP /auth/oauth2/v1/token
- bot got sts token
- bot establishes a WebSocket connection to the Messenger Bot API WebSocket server
- Once a WebSocket connection is established, sends a connection request message (a ‘connect’ command) with the sts token (from #2) information to the WebSocket server
- bot call /chatrooms/invites API with the same (#2, #4) sts token
- bot got authen error response
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛