node-flowdock
node-flowdock copied to clipboard
Support sending to the team inbox.
Create a new method that will post to the team inbox
inbox: (flowId, message, tags, callback) ->
data =
flow: flowId
event: 'mail'
source: message.source
from_address: message.from_address
subject: message.subject
content: message.content
tags: tags || []
@send "/messages", data, callback
Currently the api does not allow posting to inbox using user authorization, it only works with flow api token. The way to implement this would be to just create a Flow object that works a bit like Session but allows just posting to a flow inbox using flow api token. That said, we're about to release a new version of our message api, so I'd like to postpone this still a bit (I know this was opened in may, sorry about the dealy in reacting!)
Any updates to this?
Yeah. We have the new api details available here. Posting is as simple as providing the message and thread payload along with the new source token
. I'm not sure if creating a wrapper is any useful, since it's going to require almost the exact same parameters as just using request
. The message and thread data needs to be composed manually anyway, so the difference between
data = ... // compose message payload
data["flow_token"] = flowToken
request('/messages', {json: data}, callback)
and
flow = new Flow(flowToken)
data = ... // compose message payload
flow.inbox(data, callback)
is pretty minimal.
Do you have a complete example on how to post something to the team inbox?