Skip to content

Commit

Permalink
Merge pull request slackapi#15 from paulhammond/chat.postMessage
Browse files Browse the repository at this point in the history
Add support for chat.postMessage API method
  • Loading branch information
paulhammond committed Feb 3, 2015
2 parents 0478351 + 9c81551 commit 3b06359
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/channel.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ class Channel
m = new Message @_client, {text: text}
@sendMessage m

postMessage: (data) ->
params = data
params.channel = @id
if data.attachments
params.attachments = JSON.stringify(data.attachments)

@_client.logger.debug data
@_client.logger.debug params
@_client._apiCall "chat.postMessage", params, @_onPostMessage

_onPostMessage: (data) =>
@_client.logger.debug data

sendMessage: (message) ->
message.channel = @id
@_client._send(message)
Expand Down

0 comments on commit 3b06359

Please sign in to comment.