-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sending attachments / images? #12
Comments
Any argument to channel.send is treated as text. Technically you could send binary data over the websocket, but I the library doesn't really support it and I imagine it wouldn't show up on the other end in a useful way. |
so channel.sendtMessage should send attachments but i haven't been able to get that to work via the web API either. is there a working example/json anywhere? I couldn't find. this is what i'm sending:
is there a different |
Sorry, I don't quite understand the example here. Can you post more complete (ideally runnable) code? |
here's the method which sends the JSON above.
is a method in your lib. function testAttachment(channel) {
var att2 = {
"title": "*Title*",
"fallback": "Title: testing *right now!*",
"text": "Testing *right now!*",
"mrkdwn_in": ["text", "title", "fallback"]
}
msgpack = {
type: "message",
text: "TEST MESSAGE",
icon_url: "http://lorempixel.com/48/48/",
attachments: [att2]
}
msgpack.token = token
msgpack.channel = channel.id
console.log("msgpack", msgpack);
slack._apiCall("chat.postMessage", msgpack, function(err, res){
console.error("postMessage result:", err, res)
})
} |
I think #15 (along with some changes to the server documented in slackapi/hubot-slack#148) will fix this? Can you confirm? |
I think I'm having the same problem. I was able to send attachments before using Incoming Webhook functionality, but can't do it with Web API. Should
from https://api.slack.com/docs/attachments work with Web API? |
Does anyone know when this will be fixed? And slackapi/hubot-slack#148 to be merged. |
Any news on this? Seems that it still doesn't work on the Web API. |
I ran into this as well. Attachments do not work when using the web api (though I'm not even using the node client, I'm making a raw curl request), switching to an incoming webhook made the attachments appear. Something is broken at a lower level than the client. Hope it gets fixed. |
I found out, what the problem was / is. You NEED to JSON encode the 'attachments' argument, so the 'attachments' is actually a string and not an object. Then it should work. At least for me that worked. |
@bobalazek stringifying worked thanks. Pretty peculiar solution :) |
The |
adds note about not being enterprise ready to the sample
the demo examples here just send a text response, vis:
can this node package be used to send other types of messages, or attachments?
I've tried sending JSON like:
but just get an error back:
The text was updated successfully, but these errors were encountered: