slack-api

How to mention user in slack.client

梦想的初衷 提交于 2019-11-29 10:53:53
问题 This might be a simple question, but I can not get it work. I am using Slack Python Api to mention a user in a channel, and I am referring to the document here, https://api.slack.com/methods/chat.postMessage, and my code is simple as, from slackclient import SlackClient sc = SlackClient(token) message = sc.api_call( 'chat.postMessage', channel='#channelname', text='This is a test.' ) This will send a message to the channel, but I can not find any option to mention users. And I tried to put

How do you invoke the /poll command using the Slack API?

旧街凉风 提交于 2019-11-29 04:35:30
My slack channel supports the /poll command from the Simple Poll app. How do you invoke this command using the Slack API? Using the python slack(er) API module : from slacker import Slacker # Using what's now called a "legacy token" slack = Slacker('my-token') slack.chat.post_message( '#test', '/poll "Do you prefer cats or dogs?" "Cats" "Dogs"', as_user=False, username="Poll Bot", icon_emoji=':question:', parse='full') The message just shows up in the #test channel as plain text, not converted to a poll. I tried using <!poll> instead of /poll in the message, as sort of implied in the message

Slack: Retrieve all messages

泄露秘密 提交于 2019-11-28 19:57:09
问题 I want to retrieve all the messages that were sent in my teams slack domain. Although, I'd prefer that the data be received in XML or JSON I am able to handle the data in just about any form. How can I retrieve all these messages? Is it possible? If not, can I retrieve all the messages for a specific channel? 回答1: If you need to do this dynamically via API you can use the channels.list method to list all of the channels in your team and channels.history method to retrieve the history of each

Can I upload an image as attachment with Slack API?

六眼飞鱼酱① 提交于 2019-11-28 14:26:21
I have integrated Slack API using cURL in my project. I want to send an image as my attachment. It works while sending full image path in image_url . But when I convert that image to base64 string and then pass it with image_url it doesn't go as attachment. So basically I want to post base64 string as my image attachment. Because I don't want to store the image on my server. {"attachments": [ { "fallback": "Required text summary of the attachment that is shown by clients that understand attachments but choose not to show them.", "image_url":"", "text":"", "color":"#7CD197" } ] } You can not

Receiving too many requests in my Bot user from slack

假装没事ソ 提交于 2019-11-28 14:23:31
I am trying to implement a bot user in slack, but right now when i send a message to slack as a user, my bot gets more messages requests than it should. The event that I have added to my bot user is message.groups. I don't know if the events can interferer with the normal flow of the conversation. In this log USER REQUEST is what the user sent to the bot and BOT AWSER is what bot sends. As you can see slack is receiving the same message (event_time is the same) two times in a row, when i send just one message to the channel. Can someone tell me if this is my problem and not slack problem? What

Slack PHP API - Avoid Timeout error

旧时模样 提交于 2019-11-28 12:08:08
I am trying to use Slack Custom command and not pretty sure how to use delayed messages since the Yoda Speak External API takes more than 3 seconds to respond. I have done the following: Sent the slack command /Yoda in my case and received the reponse_url . Used the following to post the following to the response URL. $data_string = '{"response_type": "in_channel", "text":"Checking,please wait..."}' ; $chs = curl_init(); curl_setopt($chs, CURLOPT_URL, $response_url); curl_setopt($chs, CURLOPT_POST, true); curl_setopt($chs, CURLOPT_POSTFIELDS, $data_string); curl_setopt($chs, CURLOPT_SSL

Slack Incoming Webhook sends as my user

Deadly 提交于 2019-11-28 09:17:26
问题 I've created an Incoming Webhook within my Slack workspace. I'm using it from a third party tool to post a JSON object to the hook url. I want to send a notification to @user_1 My issue is that the notification sends to a private channel between myself and that user @user_1, rather than sending to @user_1 directly, say via Slackbot or a channel with only that user in. How do I ensure that the notification is sent from either Slackbot or @user_1, rather than myself? The way that I set up is by

Is it possible to post to chat.postMessage as any user in a Slack team?

独自空忆成欢 提交于 2019-11-28 04:43:28
问题 I'm building a Slack integration that is intended to modify some text and then post it to a Slack channel as though the user who triggered the command had said it. e.g. /makeFace disapproval @Ben 3:45pm ಠ_ಠ I ask for the client permission scope, which adds the chat:write:user permission. But when I hit the chat.postMessage endpoint, it only seems to allow you to post as the user who added the integration because the token it returns seems to be individuated for that user. I know that giphy,

Execute slash command as slack bot

早过忘川 提交于 2019-11-27 20:44:57
I'm writing a simple slack bot which should execute other slack commands upon being called. Everything is up and running, however the slack commands this bot issues don't seem to be executed. For instance my bot posts /giphy kitten every hour and the message appears just like that in the channel (so the sending side seems to work), but the slash command itself isn't executed. If I post the same command into the same channel myself it works as expected. Are bots not allowed to execute slash commands? Erik Kalkoken Bots can use the undocumented API method chat.command to invoke slash commands.

How do you invoke the /poll command using the Slack API?

ぐ巨炮叔叔 提交于 2019-11-27 18:34:53
问题 My slack channel supports the /poll command from the Simple Poll app. How do you invoke this command using the Slack API? Using the python slack(er) API module: from slacker import Slacker # Using what's now called a "legacy token" slack = Slacker('my-token') slack.chat.post_message( '#test', '/poll "Do you prefer cats or dogs?" "Cats" "Dogs"', as_user=False, username="Poll Bot", icon_emoji=':question:', parse='full') The message just shows up in the #test channel as plain text, not converted