Upload a file to Slack using a bot connection and the Make an API Call module

Hello Community :wave: !

I’m scratching my head over how to upload a JSON file to Slack when using a Bot connection (which can’t use the Upload a file module of Slack app) and the Slack app’s Make an API Call module.

I have tried using a personal connection and the Upload a file module and that works. I create the json using the JSON app and upload it using the module. Works.

But when I’m limited to use a bot connection I’m unable to progress. I’m following Slack’s documentation of the /files.upload endpoint, but I keep getting Error: invalid_form_data (200). from Slack.

Here’s the underlying request captured in Integromat dev tools
Screenshot 2023-08-03 at 16.59.11

And here’s the request which is made from the native Upload a File module - this runs successfully

I’m also attaching the Blueprint of the non-functioning scenario.
blueprint.json (6.7 KB)

Any idea how to format the data for Slack to handle the upload? I can obiously see the discrepancy in the value field, but I have no clue if that’s the core of the problem, nor how to actually get to a value like IMTBuffer.

Cheers! Daniel

Hi @DanBorn,

The File Upload API endpoints doesn’t need JSON instead the Content Type that you need to use is multipart/form-data and it seems that Make an API call module for Slack doesn’t support form-data and only allows JSON as part of the request.

Does this mean that the Slack Make an API Request module will never work for files.upload requests?

Yes, but that should only an issue for Bot connections (as in @DanBorn’s original case).

For normal connections, you can use the regular Upload a File module in the Slack app.