Sending files with your response
The Poe API allows you to send attachments with your bot response. When using the fastapi_poe library, send file attachments with your bot response by calling post_message_attachment
within the get_response
function of your bot.
Parameters
message_id - the message id associated with the current
QueryRequest
object being processed. Important: This must be the request that is currently being handled byget_response
. Attempting to attach files to previously handled requests will fail.
Additionally, the following must be provided
download_url - provide a url to a file that will be attached to the message.
OR
file_data - the contents of the file to be uploaded. This should be a bytes-like or file object.
filename - the name of the file to be attached.
Example
Notes
The
access_key
should be the key associated with the bot sending the response. It can be found in the edit bot page.It does not matter where
post_message_attachment
is called, as long as it is within the body ofget_response
. It can be called multiple times to attach multiple (up to 20) files.A file should not be larger than 50mb.
Last updated