Send a File to the Customer
The bot can send a file to the customer as an attachment using the File dialog step in the Einstein Bot Builder. A file attachment is a downloadable file button that is available through the APIs rich content support.
The bot can also send a link to the file in a text message, but our focus here’s on sending files as attachments with the bot’s File dialog step.
To set up the bot to send a file to a customer, use the Einstein Bot Builder to add a File dialog step. This dialog step sends a file as an attachment, which is in rich content format, to the user. The File dialog step can access files only uploaded as Salesforce assets.
Then set up the client to receive attachments with rich content format from the bot. To do that, add the
richContentCapabilities object to the initial request body to begin the session (see Begin a Session).
Attachments is the rich content format type for showing the file as a downloadable button. If your client doesn’t support rich content, but the bot uses a file dialog step, you can include the
richContentCapabilities object with the
formatType set to
Text. If you don't include
richContentCapabilities, the bot defaults to using
formatType set to
Text. In this case, the bot sends the file as a link in text format.
In this example, the bot asks the customer whether they want the “Instruction Manual” or not with a choice message response. We assume that you already set up the “Instruction Manual” as an attachment in the Einstein Bot Builder. See Answer a Question With Choices for more information on choice messages.
Let’s say the customer chooses to receive the “Instruction Manual”. Here the client sends a request with the
choice message type and the
choiceId for the instruction manual.
Here’s an example response from the bot sending the instruction manual to the customer as an attachment. In this case, the client supports the
Attachments format type. This response has the StaticContentMessage schema in the API reference doc and
Attachments format type.
If the client supports the
Text instead of
Attachments format, the bot sends the “Instruction Manual” to the customer as a text link. Here’s an example of the bot’s response with the file as a text link.