bot to save a pdf uploaded by the user to host computer
See original GitHub issueHello. I would like to create a bot that can read in an uploaded file (pdf) uploaded by the user and save it to a server (for now on the host computer). I am thinking the files.info
method might work, but I am not sure how to get to the specific file. Could you post an example of how to do this?
import os
from slack_bolt import App
app = App(
token= os.environ.get('SLACK_BOT_TOKEN'),
signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
)
# # # LISTENING FUNCTIONS # # #
# This will matc h any message that contains "Hi!"
@app.message("Hi!")
def initial_message_func(message, say):
say("please upload your pdf")
@app.message("")
def message_to_sam_func(client,message):
client.file.info(file = file_ID) #not sure how to get file_ID
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Extract Data From PDF: Convert PDF Files Into Structured Data.
At Docparser, we offer a powerful yet easy-to-use set of tools to extract data from PDF files. Our solution was designed for the...
Read more >How to Add PDF Files to Websites - Lifewire
Use your web host's file upload program to upload PDF files to your website. If they don't offer one, use an FTP program....
Read more >Using Upload Document action
The Upload Document action enables you to upload a document with IQ Bot. IQ Bot extracts fields from the document and exports them...
Read more >files.upload method - Slack API
This method allows you to create or upload an existing file. You must provide either a file or content parameter. The content of...
Read more >How to save one page of a PDF - Adobe
Drag and drop your file. Once it uploads, use the scissors tool to indicate which page you want to separate out. Click continue....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you for the help. Posted final code in case others had issues
In case you need your slack bot to recieve a file shared by DM here a starting point
You need
ngrok
to be running (when in development mode) and you need to enable Event Subscriptions and configure it with the URL that ngrok generates automatically.Keep in mind that if you restart ngrok a new URL will be generated
If you want a stable URL you need to pay for ngrok or set another type of forwarding - https://ngrok.com/docs