Flowdock - REST API: How to upload a file?

Document ID : KB000115267
Last Modified Date : 18/09/2018
Show Technical Document Details
Question:
How can we use Flowdock REST API to upload a file to a flow?
Answer:
We shall provide two examples of uploading a text file as well as a jpg file.

Example 1: Upload a text file.
1. Encode the file's contents to Base-64 encoding. In our example, we'll use this site to make this encryption.
- Our file's text:
"This is a text file that is being uploaded to flowdock's flow using REST API."

- The encoded text: "VGhpcyBpcyBhIHRleHQgZmlsZSB0aGF0IGlzIGJlaW5nIHVwbG9hZGVkIHRvIGZsb3dkb2NrJ3MgZmxvdyB1c2luZyBSRVNUIEFQSS4="

2. Post a 'file' event to your flow where the JSON content's data argument has the encrypted Base-64 value. See this screen shot below.

User-added image

Make certain to replace <Organization Name> and <Flow Name> with your appropriate names.

3. Result. Your file is posted to the flow, see this screen shot:

User-added image

Example 2: Uploaded a jpg image file.
1. Encode your image file to Base-64 encoding. You can use same site mentioned earlier, submit your file and get the encoded string.

2. Post a 'file' event to your flow where the JSON content's data argument has the encrypted Base-64 value. See this screen shot below.

User-added image


3. Result. Your file is posted to the flow, see this screen shot:

User-added image
Additional Information:
More on Flowdock API, see: https://www.flowdock.com/api