You are here:
Send a File with Dynamic Content from an Enhanced Bot
Send a dynamic file as a bot message. For example, fill in and send a personalized invoice related to an account.
Required Editions
| View supported editions for Einstein Bots. |
| View supported editions for Messaging. |
| User Permissions Needed | |
|---|---|
| To build and manage Einstein Bots: | Customize Application OR Modify Metadata OR Manage Bots |
Supported file types and sizes vary by channel. See Send Images and Files in Messaging Sessions.
To use a dynamic file in bot conversations, create an Apex class or flow that creates a file, uploads it to Files home, and returns the file’s ContentVersionId as output. To use a file created by an external service, create an Apex class or flow that stores the file in Files home and returns its ContentVersionId. See File with Dynamic Content: Example Apex Class.
- In the Bot Builder, click Dialogs, and then select the dialog that you want to send a file from.
-
Add the Apex or Flow action dialog step to the dialog. Then create a bot variable that
stores your Apex class or flow’s output.
- From the Dialog Component Library, drag the Apex or Flow action onto the canvas.
- In the Step Properties panel, in the Variable Name field, select the Apex class or flow that you created.
- In the Variable Name field, create an ID variable that stores the action output.
-
Add the File dialog step to the dialog.
- From the Dialog Component Library, drag the File dialog step onto the canvas.
- In the Step Properties panel, in the File Interaction field, select Send File. And for the content type, select Dynamic (Content Version Variable).
- In the Variable Name field, enter and select the name of the ID variable you created. If you don’t see your variable, refresh the builder and try again.
- Save your changes.
When you’re ready, activate your bot.
- File with Dynamic Content: Example Apex Class
To send a dynamic file with your enhanced bot, create an Apex class that generates a file and returns theContentVersionIdvariable as output.
Did this article solve your issue?
Let us know so we can improve!

