node-flowdock icon indicating copy to clipboard operation
node-flowdock copied to clipboard

Support sending to the team inbox.

Open rteabeault opened this issue 10 years ago • 4 comments

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

rteabeault avatar May 12 '14 19:05 rteabeault

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!)

Mumakil avatar Sep 26 '14 08:09 Mumakil

Any updates to this?

kimmobrunfeldt avatar Jun 22 '15 11:06 kimmobrunfeldt

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.

Mumakil avatar Jun 22 '15 13:06 Mumakil

Do you have a complete example on how to post something to the team inbox?

fitch avatar Aug 20 '15 16:08 fitch