Important: Make sure you have enabled the “Use the Botpress Client” setting in your bot’s settings in Botpress Studio in order to have access to the client
global variable, otherwise it will not be accessible and you’ll get an error.
file.url
property.
By default the file URL returned will be temporary and change on each request to this endpoint, and will expire after a short period of time and thus should not be stored long-term, but if the file was created with a ‘public_content’ access policy then this URL will be permanent and can be stored long-term.
url
parameter instead of using the content
parameter:
Buffer
object as the content
parameter for the file:
BOTPRESS_PAT
and BOTPRESS_BOT_ID
respectively.
fetch()
function in Javascript/TypeScript, note that your Botpress PAT will need to be defined in the environment variable BOTPRESS_PAT
:
public_content
access policy to the file:
Note: Making a file publicly accessible only makes its content public but not its metadata or the ability to modify the file, which remains private. The file will be accessible through a unique permanent URL provided by the API for each file, and this URL can be stored long-term.If you only want to allow all the integrations installed in the bot to access the file rather than making it fully public, you can just assign the
integrations
access policy instead:
tags
parameter when it’s created. Tags allow you to organize and classify files in any way you see fit, and can be specified as a filter when listing or searching files.