---
schema_version: "1"
id: 0a82a1e610817c60e28c305738ee12098d6538c741015ee5fb7d94d829d99b8f
title: Send a File with Dynamic Content from an Enhanced Bot
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/service/264-0-0/bots_service_enhanced_dynamic_file.md
canonical_url: https://help.salesforce.com/s/articleView?id=service.bots_service_enhanced_dynamic_file.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 24025b955b5ecb3c991c5021f15ccce24a0731550fdb5127fba811c9cea95d88
description: Send a dynamic file as a bot message. For example, fill in and send a personalized invoice related to an account.
products:
  - Service Cloud
  - Service Intelligence
release: "264"
---
# 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

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=service.einstein_service_intro.htm&amp;language=en_US" target="_blank">View supported editions</a> for Einstein Bots.</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=service.messaging_editions.htm&amp;language=en_US" target="_blank">View supported editions</a> for Messaging.</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d99195e64">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d99195e64 ">To build and manage Einstein Bots:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d99195e64 ">
              <p>Customize Application</p>
              <p>OR</p>
              <p>Modify Metadata</p>
              <p>OR</p>
              <p style="margin-bottom:0;">Manage Bots</p>
            </td>

          </tr>
        </tbody>
      </table>

Supported file types and sizes vary by channel. See [Send Images and Files in Messaging Sessions](https://help.salesforce.com/s/articleView?id=service.livemessage_agent_send_files.htm&type=5&language=en_US).

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](https://help.salesforce.com/s/articleView?id=service.bots_service_enhanced_dynamic_file_apex.htm&release=264.0.0&type=5 "To send a dynamic file with your enhanced bot, create an Apex class that generates a file and returns the ContentVersionId variable as output.").

1. In the Bot Builder, click **Dialogs**, and then select the dialog that you want to send a file from.
2. 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.
    1. From the Dialog Component Library, drag the **Apex** or **Flow** action onto the canvas.
    2. In the Step Properties panel, in the Variable Name field, select the Apex class or flow that you created.
    3. In the Variable Name field, create an ID variable that stores the action output.
3. Add the File dialog step to the dialog.
    1. From the Dialog Component Library, drag the **File** dialog step onto the canvas.
    2. In the Step Properties panel, in the File Interaction field, select **Send File**. And for the content type, select **Dynamic (Content Version Variable)**.
    3. 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.
4. Save your changes.

When you’re ready, activate your bot.

- **[File with Dynamic Content: Example Apex Class](https://help.salesforce.com/s/articleView?id=service.bots_service_enhanced_dynamic_file_apex.htm&release=264.0.0&type=5)**  
    To send a dynamic file with your enhanced bot, create an Apex class that generates a file and returns the `ContentVersionId` variable as output.