Give users the ability to transfer files during a chat so they can share information about their issues.
important: The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to Messaging for In-App and Web before that date. Messaging offers many of the chat features that you love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in Help.
The agent can request that the user transfer a file by clicking the Attach File button from the Service Cloud Console.

See Transfer Files During a Chat in Salesforce Help for details about setting up this functionality in the Service Cloud Console.
With the default UI, the user sees a FILE TRANSFER REQUESTED message in the app and can then send a file using the camera button.

If you're using the default UI, no coding is necessary in your app to get this behavior.
However, if you're using the Core API, you must present your own file transfer UI based on file transfer events. Create a FileTransferRequestListener and pass it to the ChatClient using the addFileTransferRequestListener method. This listener gives you access to two events.
-
onFileTransferRequest
- : The SDK calls this method when an agent requests a file transfer. You're given a
FileTransferAssistantobject, which lets you upload a file with theuploadFilemethod.
- : The SDK calls this method when an agent requests a file transfer. You're given a
-
onFileTransferStatusChanged
- : The SDK calls this method when the status of a file transfer has changed. You're given a
FileTransferStatusenumerated type that describes the status of the file transfer.
- : The SDK calls this method when the status of a file transfer has changed. You're given a
You can use the following code sample as a starting point for your listener implementation.
In Java:
class MyFileTransferRequestListener implements FileTransferRequestListener {
private byte[] uploadFile = new byte[]; // TO DO: File to upload
private String fileType = "image/png"; // TO DO: File type
@Override
public void onFileTransferRequest (FileTransferAssistant fileTransferAssistant) {
// TO DO: Prompt user and read the file from storage
fileTransferAssistant.uploadFile(uploadFile, fileType);
}
@Override
public void onFileTransferStatusChanged (FileTransferStatus status) {
switch (status) {
case Completed:
// TO DO: File transfer completed
break;
case Canceled:
// TO DO: File transfer canceled
break;
case Failed:
// TO DO: File transfer failed
break;
case LocalError:
// TO DO: Local error with transfer
break;
case Requested:
// TO DO: File transfer requested
// NOTE: You'll also get a call to
// onFileTransferRequest during this state,
// where you can handle the request and
// then upload a file...
break;
}
}
}
In Kotlin:
class MyFileTransferRequestListener : FileTransferRequestListener {
var uploadFile = ByteArray(32768) // TO DO: File to upload
var fileType: String = "image/png" // TO DO: File type
override fun onFileTransferRequest(fileTransferAssistant: FileTransferAssistant?) {
// TO DO: Prompt user and read the file from storage
fileTransferAssistant?.uploadFile(uploadFile, fileType)
}
override fun onFileTransferStatusChanged(status: FileTransferStatus?) {
when (status) {
FileTransferStatus.Completed -> {
// TO DO: File transfer completed
}
FileTransferStatus.Canceled -> {
// TO DO: File transfer canceled
}
FileTransferStatus.Failed -> {
// TO DO: File transfer failed
}
FileTransferStatus.LocalError -> {
// TO DO: Local error with transfer
}
FileTransferStatus.Requested -> {
// TO DO: File transfer requested
// NOTE: You'll also get a call to
// onFileTransferRequest during this state,
// where you can handle the request and
// then upload a file...
}
}
}
}