POST/bots/{botId}/attachments

Creates an upload URL and a file ID for a file or an image used by the bot service.

Note

  • For how to download content using the API, see Upload or Download Files.

Caution

  • An upload URL and a file ID are valid only for 24 hours from the time when the Upload content API operation is called. Make sure to upload and use the content within the time.
  • The upload URL that was used to upload content cannot be reused.
  • The maximum upload size is the same as the value specified in Maximum size for a single file under Service > Message > General > File Policy in the LINE WORKS Admin.
  • The maximum file size is limited to 1 MB for message types except for File and Image, and rich menus.

Authorization

oauth2

OAuth 2.0 authentication.
For more information, see Authentication and Authorization.

Scope

bot.message
bot

HTTP Request

POSThttps://www.worksapis.com/v1.0/bots/{botId}/attachments

Path Parameters

ParameterTypeDescription
botId integer 

Bot ID


required
example : 2000001
format : int64 

Header Parameters

HeadertypeDescription
Authorization string 

Bearer {token}


required 
Content-Type string 

application/json


required
example : application/json 

Request Body

PropertyTypeDescription
fileName string 

File name

 

Request Example

example

1{2  "fileName": "ExampleFile.pdf"3}

Response

HTTP 200

OK

PropertyTypeDescription
fileId string 

File ID


required 
uploadUrl string 

URL to upload a file


required 

Response Example

example

1{2  "fileId": "jp1.1628695315008671000.1628781715.0.1000001.0.0.0",3  "uploadUrl": "https://storage.worksmobile.com/k/emsg/r/jp1/1628695775389602000.1628782175.1.1000001.0.0.0/file.pdf"4}