In a Photo Upload input question, customers provide images that are relevant to the context of the Interaction flow. For example, you can ask customers to upload photos of their documents, or send pictures taken at the scene of an accident.
Once you receive these photos, you can store them in Image type variables, and use them in other parts of the Interaction. The following Interaction elements can accept Image type variables:
- Elements containing an HTML editor: You can display one or more uploaded photos in a Paragraph, a Resource, and in the body of an Email notification.
- Email attachments: You can send one or more uploaded photos as an attachment to an Email notification. For instance, you might ask customers to take pictures of a device that needs repair, and then attach those photos to an email addressed to your repairs department.
This article presents a sample Interaction flow involving a Photo Upload question, and explains how to use the uploaded photos in Allocators, Decisions Points and Email elements.
The Interaction Flow
The example Interaction excerpt shown here shows a flow in which uploaded photos are obtained and then used in an Email element.
- Step 1: Customers upload photos in a Photo Upload question. The photos are stored in a Collection of Image type variable.
- Step 2: A new user variable is created. Using an allocator, its value is set to be the first photo of the Image Collection defined in Step 1.
- Step 3: A Decision Point element checks whether or not any photos were uploaded in Step 1.
- Step 4: If photos were uploaded, an email notification is sent containing the first photo of the collection in the body of the email. In addition, the entire Image Collection is included in an attachment to the email.
Each step is described in more detail in the sections below.
The Photo Upload Question
Any photos uploaded in response to a Photo Upload question are stored in a Collection of Image type variable. This variable is specified in the Saved Selection parameter when designing the question.
If no Collection of Image type variable exists when you design the question, the Designer will prompt you to create one. For more detailed information, refer to Photo Upload: Getting Images from Your Customers.
The Allocator: Accessing an Image From the Collection
In this step we create a new user variable of type Image. Then, using an allocation, we set the value of the variable to one of the pictures in the collection in which the photos are stored (My Uploaded Images).
Later in the Interaction, we will then able to display the photo in Paragraphs, Resources and email texts by inserting this variable into the relevant HTML editor.
To create an Image variable and allocate its value:
- From the Variable Editor, create a new user variable of type Image.
- From the Allocator editor, create a new allocation to set the value of the new variable:
On the left side of the allocation, select the variable that you created in Step 1.
On the right side of the allocation, select My Uploaded Images.elementAt. Then, in the parentheses, enter the index of the photo that you need. In the example below, the value of the Image to Upload variable is set to the first image in the My Uploaded Images collection.
For more detailed information about creating allocators, refer to Allocating Values to Variables.
Decision Points: Determining if Images were Uploaded
In this step, a Decision Point element is used to determine whether or not the customer uploaded photos in the Photo Upload question. If photos were uploaded, we will send an email notification in the next step of the Interaction. (If no photos were uploaded, the customer is presented with a Thank You statement.)
To assign the Decision Point element:
- On the left side of your Decision Point condition, select an Image type variable (created in Step 2 of the previous section).
Note: When you select an Image type variable, the right side of the condition is not needed, so it is not displayed.
- Select Is empty or Is not empty for the operator, as needed.
- Click Save to save the Decision Point.
The Email Element
In this phase we create an email notification. For practice, we will display an individual photo in the body of the email, and include an image collection as an attachment. (Note that you may send any image variable as an attachment, including a single photo. For information about accessing a single photo from an image collection, refer to the Allocator section above.)
The completed Email editor will look like this:
For complete information about creating email notifications, click here.
To insert an uploaded photo into the body of an email:
- In the Email editor, position the cursor at the point where you want to insert the photo. Then, enter @.
The Variables list opens.
- Select the required variable. The variable you select must be of type Image.
A placeholder frame for the photo is inserted at the point selected in the Email editor. The name of the selected variable is displayed inside the frame.
- To edit the presentation of the photo, click on the placeholder frame, and then use the toolbar options to resize or realign the frame. You may also adjust the size of the photo by clicking on a corner of the frame and then dragging until the required size is displayed.
To create an attachment of uploaded photos:
- In the Email editor, position the cursor on the Attached line, and then enter @.
The Variables list opens. Note that only variables of type Image (single and collections) are available.
- Select the required variable.
The name of the selected variable is displayed on the Attached line in a gray frame.