Copying a Wufoo attachment to Box

Use IBM® App Connect to create an event-driven flow that copies a Wufoo file attachment from a submitted form and adds it as a Box file.

Scenario

In this scenario, an Accounts department receives expense reports as Wufoo forms that employees complete and attach their expense reports to. When a form is submitted, App Connect copies the Wufoo attachment to Box so that you can collate and process the submitted expense reports monthly.

Figure 1. Event-driven flow for the Wufoo to Box scenario
Screenshot showing a Wufoo New form entry event node followed by a Box Create file action node.
To find out more about how to use App Connect with Box or Wufoo, see the following how-to guides:

Find or create what you need

  1. Sign up for a free account or business account for Box.
  2. Sign up for a paid Wufoo account. You need a paid plan to use the File Upload capability that is used in this tutorial.
  3. To connect to your applications, get the following account details for your Box and Wufoo accounts.
    • The email address and password for your Box account.
    • The API key and subdomain of your Wufoo account.

      To find your Wufoo API key, go to the Wufoo Form Manager, open the More menu for any of your forms, and click API information. (The same 16-digit API key is used for all your forms.) You can copy and paste this API key into App Connect.

      To find your Wufoo subdomain, click Account > My account. The subdomain value is between https:// and .wufoo.com.
      Figure 2. Finding your Wufoo subdomain
      Finding your Wufoo subdomain
    To connect App Connect to Box and Wufoo, complete the following steps in App Connect.
    1. Open the App Connect catalog Icon that represents the catalog.
    2. If Not connected is shown for Box or Wufoo, expand that row, then click Connect to enter the account information.
    3. If prompted, allow IBM App Connect to access the application's account.
    Tip: Alternatively, you can connect to an application when you add it to a flow.
  4. Create a Wufoo form to which expense reports can be attached.
    1. Log in to your Wufoo account with the credentials that you used in App Connect.
    2. Create a Wufoo form from scratch with the form title Expense report submission and the description Fill me in to get your cash back.
    3. Click Add Field and on the Add a Field tab, click Section Break.
    4. On the Field Settings tab, set Field Label to Expense report for:, and set Instructions for User to Select the month and year.
    5. Click Add Field, then add a Single Line Text field. On the Field Settings tab for the new field, set Field Label to Month. Repeat this step to add a field with the label Year.
    6. On the Add a Field tab, click Section Break, then on the Field Settings tab for the new section, set Field Label to Details: and set Instructions for User to Complete your details.
    7. Click Add Field, then add a Name field and an Email field.
    8. To add a button for users to attach their expense report, click File Upload, then change the field label to Attach expense report.
      Figure 3. New Wufoo form example
      New Wufoo form example
    9. Click Save Form, then click Share this form. (You can also share the form later from the Wufoo Form Manager by clicking Start sharing.)
    10. From the Share page, make a note of the permanent link for your form, which you can use to test the flow. Remain logged in to your Wufoo account.
      Tip: App Connect supports the use of embedded Wufoo forms. You can copy the embed code from the Share page and use it to display the form in your own web page. For example, to embed in a WordPress website, copy the code on the embed on WordPress tab, then paste it into a WordPress document. After you publish the WordPress document, you can send users the link to the published document that contains the embedded form.
  5. Create a text file with the name expense_jdoe01.txt that contains the following text:
    Jane Doe: My expense report for Sep 2023
    1234
  6. In your Box instance, create a folder with the name ExpenseReports and assign editor permission.

Create your flow

In App Connect Designer, complete the following steps to create your flow.
  1. From the Designer home page Icon that represents the Designer home page, click Create an event-driven flow, or from the Designer dashboard Icon that represents the Designer dashboard page, click Create > Event-driven flow.
    Tip: As you progress, App Connect saves your changes automatically. If you leave the flow editor at any stage, the flow is saved as a draft flow that you can complete at another time.
  2. Enter a name that identifies the purpose of your flow (for example, Add expense reports to Box).
  3. Add the Wufoo New form entry event to trigger your flow.
    1. Click Add trigger node Icon to add a trigger node to start your flow, expand Wufoo, then select New form entry.
      Note: If you didn't connect App Connect to your Wufoo account in the catalog, you can connect to it when you add the event to your flow. If you don't see a list of applications under Not connected, click Show more applications and APIs.
    2. Select the Wufoo form that you created earlier (Expense Report Submission). When someone completes and submits the expense report form, App Connect completes the action that you add to the flow in the next step.
      Figure 4. Wufoo New form entry event to trigger the flow
      Wufoo / New form entry event to trigger the flow
  4. Add the Box Create file action to your flow.
    1. Click Add node Icon to add a node to the flow, then click Box > Files > Create file.
    2. In Folder, select the ExpenseReports folder that you created earlier.
    3. To help with collation in Box, prefix the file names of your submitted expense reports with the month and year for which expenses are being claimed in Wufoo.
      1. Click in the File name field, click Insert a mapping Insert a mapping icon, then select Month from the available values.
      2. Repeat this step to select the Year value.
      3. Type an underscore (_), click Insert a mapping Insert a mapping icon, then select File Name.
        Note: The list of available inputs is auto-populated with the fields that you added to your Expense Report Submission Wufoo form. For example, month, year, and email. A set of date and ID fields that are auto-generated in Wufoo are also included.
    4. In File content, type fi, then select File Content from the list (to indicate that the file contents of the Wufoo attachment must be copied to the Box file).
    5. In Type of file, select Text from the list.
      Figure 5. Entries for the Box Create file action
      Entries for the Create file action in Box
  5. If you're on the VPC hours plan, you can test your flow by starting it in App Connect Designer. If you're on the flow runs plan, you must deploy and activate your flow before you can test it.
    • On the VPC hours plan, click Start flow on the toolbar, then click Dashboard to exit the flow. Your flow is displayed on your Dashboard as running, and is listening for your event, which is a submitted form in Wufoo.
    • On the flow runs plan, go to the Manage tab Icon that represents the Manage tab, click Deploy, then select your flow. Click Next, then Deploy. A tile is created for your flow. To start it, open the tile menu, then click Activate.

Test your flow

To test the flow, you can assume the roles of an accounting team member and an employee who wants to submit an expense report.

To test the flow as an employee, complete the following steps.
  1. From a new browser tab or window, paste in the permanent link of the Wufoo form that you created earlier.
  2. Complete the form as follows:
    • Month: September
    • Year: 2017
    • Name: Jane Doe
    • Email: jane_doe@example.com
    • Attach expense report: Click Browse and select the expense_jdoe01.txt file that you created earlier.
  3. Click Submit.
    Figure 6. Completed Wufoo form
    Completed Wufoo form
To test the flow as an accounting team member, complete the following steps.
  1. Go back to the browser tab or window where you created the form.
  2. Go to the Form Manager and verify you can see that an entry was submitted.
    Figure 7. Entry for completed Wufoo form
    Entry for completed Wufoo form
  3. If necessary, log in to your Box account with the credentials that you used in App Connect. If you are already logged in, refresh your browser. (You might have to wait a few minutes for the file transfer to complete.)
  4. Open the ExpenseReports folder and verify that you can see a file with the name September2017_expense_jdoe01.txt.
    Figure 8. Wufoo attachment added to Box
    Wufoo attachment added to Box

Growth icon for stretch exercises
Try something a little different

In the preceding scenario, you created a flow that copies Wufoo attachments to a folder in your Box account. In this scenario, you want to ensure that the files (typically attached as expense.txt) are uniquely renamed in the Box folder for each user submission per month. To achieve this scenario, you can use App Connect's flow management and transformation functions.

Complete the following steps to update and retest the flow.

  1. Create a text file named expense.txt, which can be attached to the Wufoo form. (You can make a copy of the previous file and rename it.)
  2. Now, stop the flow so you can edit it.
    1. From the Dashboard, locate the flow. To locate a flow quickly, enter the first few characters of the flow's name in the search box (in this case, Add).
      Figure 9. Tools for locating or sorting flows
      Tools for locating or sorting flows
    2. Open the flow menu, and then click Stop. (Other options are available to view the flow while it's running, manage errors, export the flow for sharing, and delete the flow if no longer needed.
      Figure 10. Flow menu options
      Flow menu options
  3. To edit the flow, click anywhere on the tile.
  4. From the flow editor, click the Box node.

    Now, update the fields for the "Create file" action to specify a different naming convention for the file attachments.

  5. Update the File name field by applying transform functions to define a file naming convention of mmmyyyy_username_filename.txt.
    1. In the File name field, click Month and then select Apply a function from the menu. Then select $substring() from the Functions list. The Month value is then shown as: {{$substring(Month, start, length)}}
    2. Click start and then type 0 (that is, zero). Click length and then type 3. This function extracts the first three characters in a month's name.
      Figure 11. Updated Month value in the file name field
      Updated Month value in the File name field
    3. Click after the underscore (_). Then click Insert a reference Insert a mapping icon, and then select Email from the list of available inputs. Then type another underscore.
    4. Click Email and then select Apply a function from the menu. Then select $substringBefore() from the Functions list. The Email value is then shown as: {{$substringBefore(Email, "chars")}}
    5. Click chars and then type @. This function extracts the username from an email address username@domain, by using the ampersand (@) as the delimiting character.
      The completed entries for the "Create file" action are similar to the following example.
      Figure 12. Updated Box fields
      Updated Box fields
  6. To restart the flow, open the options menu [⋮] in the banner and then click Start flow. Then click Dashboard to exit the flow. In the Dashboard, the flow is shown as running again.
  7. From a new browser tab or window, paste in the permanent link of the Wufoo form that you created earlier, and then complete the form as follows:
    • Month: September
    • Year: 2017
    • Name: Huck Finn
    • Email: huckfinn@example.com
    • Attach expense report: Click Browse and select the expense.txt file that you created earlier.

      Click Submit.

  8. If necessary, log in to your Box account with the credentials that you configured in App Connect. If you're already logged in, refresh your browser. (You might have to wait a few minutes for the file transfer to complete.)
  9. Open the ExpenseReports folder and verify that you can see a file with the name Sep2017_huckfinn_expense.txt.
    Figure 13. File in Box folder
    File in Box folder