How to Access and Extract Text from a File Uploaded on Slack using Pipedream?

This topic was automatically generated from Slack. You can find the original thread here.

Guy’s. I hope someone can help me with this. I am trying to do the following

  1. setup a slack trigger that triggers when someone uploads a file in a channel (works, no biggy)
  2. Then I try to get that file (usually a PDF) and get the text out of it. And here is the problem, I cannot access this file in pipedream, at least not the public one

I tried to get it from url_private_download but- this requires you to be logged in and even though I would expect that the authentication would be inherited from the trigger, it wasn’t.
also:
I tried to do it ‘manually’ using a code block and the token to fetch it, like so (code below) But this gives HTML (most likely the ‘not found’ page)

Can anyone help me with this? I have a deadline that low-code is perfect for and I really want this to work this way (because it’s awesome. :slightly_smiling_face: )
Thank you so much!

def handler(pd: "pipedream"):
    url = pd.steps["get_file"]["$return_value"]["file"]["url_private_download"]
    print(url)
    token = 'xoxe.xoxp-1-Mi0yLTU2Nzg3MzE1NDY0MzktNTcwNTkzNDgzNTY4MS02MDQ5NzAxODY2MTk3LTYwNDU5ODE5MDc2MjItNGQ1NTkwZjAxYjg4Yjk1NjJlNzM3MGI3MjRjZTE4MGQ2MmY*************************'
    headers = {'Authorization': 'Bearer %s' % token}


    response = [requests.post](http://requests.post)(url=url, headers=headers, timeout=120)
    print(response.content)

I fixed this by creating an app in Slack, and use Pipedream as a webhook receipient manually.