![]() SocketModeHandler(app, SLACK_SOCKET_TOKEN). when a user clicks on this button in their team channel, we want to reply to the general alert channel (channel_id1) to notify that the user clicked they are working on itĭef working_on_issue_button(ack, body, logger, client):īutton_response = client.chat_postMessage(channel=channel_id, thread_ts=response_ts, text=f" is working on this issue.")Īpp.event("working_on_issue")(working_on_issue_button) Response_ts = this references a button in the block message. Result2 = client.chat_postMessage(channel=channel_id2, text="An error has occurred", blocks=message_block2) Result = client.chat_postMessage(channel=channel_id, text="Error has occurred", blocks=message_block) # first block message goes to channel 1 and second goes to channel 2 so slightly different messaging In the Add features and functionality section, click on Incoming Webhooks. Choose From scratch, give your app a name, and select the workspace you want to develop it in. Go to the Slack API page and click the Create New App button. # We need to post in channel 1 to say there is an issue, and then notify the team that would resolve the issue by posting in their channel (channel 2) 53 minutes ago &0183 &32 Step 1: Create a Slack App and Set up Incoming Webhooks. Here's what I have right now: import requestsįrom slack_mode import SocketModeHandlerįrom slack_sdk.errors import SlackApiErrorĬlient = WebClient(token=SLACK_APP_TOKEN) I’m just running into a wall with what to Google and feel like I’m only going in circles at this point so hoping for any ideas on how to proceed.ĮDIT: What I have right now is mostly focusing on getting the posts to work, so the part of getting it all to trigger with the webhook is what I'm struggling with. This is all relatively new to me so I may be missing some crucial information. I’ve seen some documentation on posting a message from the payload sent to the webhook but I can’t figure out how to use that webhook to run the script. Does that make sense? Is that possible? I’m doing this in Python. Any data your webhook sends to Slack can be referenced in subsequent workflow steps by creating variables. You can use all the usual formatting and layout blocks with Incoming Webhooks to make the messages stand out. Creating an Incoming Webhook gives you a unique URL to which you send a JSON payload with the message text and some options. I would then need this webhook to trigger a script which would handle the posting and the necessary user interactions. Slack will generate a unique request URL for your workflow once you publish it, and you can configure your webhook to pass information to Slack via the HTTP request body. Incoming Webhooks are a simple way to post messages from apps into Slack. My thought was that I could configure the external monitoring system to send the alert to the incoming webhook I can create in the Slack app. ![]() I need to make a block kit formatted post in a Slack channel when an external monitoring system catches an error. I’m not entirely sure that I’m even thinking about this correctly, but here’s the goal and here’s what I’m thinking.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |