I am using bot enterprise on-premises and have a requirement to use RTM + Websockets on the server-side, i see the documentation below but details are vague, is there an example of simple send, receive user message.
@sudheej
I am not sure why you want to use the RTM + WebSocket on the server and not our web channel but the process of communication using web-socket is explained at a high level remains the same, regardless of whether you use the websdk or implement a custom solution.
For using RTM and WebSocket, the mentioned URL gives you basic steps.
Step 1: First the authentication JWT is required. This will return an access token (JWT) using the client id, secret, anonymous and userIdentity.
Step2: Then /jwtgrant call will validate the JWT.
Step3: /rtm/start call will return the websocket URL. This URL has to be used to establish a connection.
There are few more things which our web-sdk does - like sending and receiving messages from WebSocket. You may study the same on our open-source sdk.
@swagata.sengupta Thank you for the response, i have usecase to connect with the bot from serverside, may be i am not using the correct sdk. Is there bot sdk available ?
All i am trying to do is to build an api that could send and receive message from the bot using node.
So far i’ve managed to use websdk and replace few of the dependenecies in kore-sdk js file such as replaced dom with jsdom, browser-request with request and ws with websocket (node library).
The bot is responding back to message[“type”] = “ping” with a pong response. However when i send a message i do get “internal server error” from the bot. I believe using web sdk is the wrong approach since the lib are client side.