English 中文(简体)
What is slack websocket payload after you receive Hello message?
原标题:

I m doing everything in here:

https://api.slack.com/apis/connections/socket

I get my:

{"type":"hello","num_connections":1,"debug_info":{"host":"applink-2","build_number":36,"approximate_connection_time":18060},"connection_info":{"app_id":"A05GWDCG6GY"}}

hello message on the web socket connection. Then I want to use that connection not to receive events, but to post as a specific user with a user token.

I ve tried various payloads like:

  message := map[string]string{}
  message["type"] = "message"
  message["channel"] = channel
  message["app_id"] = s.AppId
  message["user_id"] = user
  message["text"] = "test123"
  message["token"] = token
  asBytes, _ = json.Marshal(message)

but there doesn t seem to be any docs on how to send a message as a user over web sockets or set their presence. My goal being:

How to get the green dot to turn on for slack user from API POST to users.setPresence?

问题回答

There is no way to do this with their Socket Mode system. You can receive events from the web socket connections, but you cannot post as a user or set the user to online. The only way to do this would be cookie auth and actually run a browser with the user logged in.





相关问题
Using Starts with to find the key of a List

I have a list of objects, one of them is appended dynamically upstream and then passed in an array list. I need to fetch out this key (it looks like this: status_block_EPOCH) but when I try to filter ...

AI Chatbot Implementation and integration with Slack

I have to build a chatbot based on my compnay data. The data is in a pdf file. I want the chatbot to be trained in such a way that it answers any query that has an answer in the document. I dont want ...

Slack-Bolt Python API not picking up messages correctly?

I am trying to use the Slack-bolt API for Python to listen to DMs to the slack bot that contain specific text. Here is my file that initiates the Slack-Bolt listener: import os from server import * ...

Listing channels that Slackbot is a member of

I have a small script which uses the slack API to create group chats with users and send an intro message. There are around ~100 of these group chats that I have created, but unfortunately I only ...

热门标签