You may want to receive an email if an inspection contains one or more responses designated by the template author as a “failed response”. Failed responses help you identify common issue areas across your inspections, and this integration can help you set up a workflow that notifies the right people when an item is designated  “failed.” 

This page demonstrates how to set up a workflow that automatically sends an email to your preferred recipient containing the exported inspection report with its corresponding failed items using Zapier.

Requirements

Steps to set up your Zap

Each Zap is set up using a single trigger and a series of actions. A trigger in Zapier is the event that causes particular results and an action is a process that is the result of the trigger.

In this setup, the initial trigger is the inspection completion in iAuditor, which is followed up with a Python* script to update the Zap if the inspection contains failed items. The final action triggers the export of the “failed items” report, sent using Gmail. 

*Python is a common programming coding language. This article’s script is used to determine whether an inspection has any failed items, and if it does, proceed with the final action of sending a report. 

Trigger: 1. Any inspection (audit) completion in iAuditor

  1. Setup or sign-in to your Zapier account.
  2. Select “Make a Zap!” (+ icon) in the upper left-hand corner.
  3. Step 2 then prompts you to input a “Trigger” app.
  4.  Type “iAuditor by SafetyCulture” in the search box.
  5. Choose trigger event as “Any Audit Completion” - this sets the zap to trigger on any inspection completion.
  6. Click “CONTINUE”.
  7. If this is your first Zap with iAuditor, you will need to “+ Add a New Account” by providing your API token.
  8. Otherwise, select your iAuditor account from the drop-down list and click “CONTINUE”.
  9. Click “TEST & REVIEW” to test the zap.
  10. Click “Done Editing” and proceed to your next action.

Action: 2. Run Python

  1. After completing the “trigger” step, click the “+” button to add a new action.
  2. Search for “Code by Zapier” and choose “Run Python”.
  3. Click “CONTINUE”.
  4. To configure the input data, type "audit_id" in the first input data field.
  5. Select the “Audit ID” value from the drop-down on the right column (shown below).
  6. Delete the sample code that is pre-filled in the “Code” section of the Zap and enter the following:

    IMPORTANT NOTE

    We have provided a simple example script for download to get you started! We encourage you to modify it for your own needs.

  7. Click “Test & Review”.
  8. After a successful test, select “Done Editing” and proceed to your next action.

Action: 3. Only continue if

  1. Click “+” to add another action.
  2. Choose “Filter”.
  3. Under “Filter Setup & Testing”, set “Proceed” and “(Boolean) is true”.

  4. Zapier automatically performs a test to see if the filter works.
  5. Click “Continue” and “Done editing” to proceed to your next action.

Action: 4. Start inspection export (new)

Next, we'll create an action to export the reports with failed items that will be used as an attachment to the email.

  1. Click “+” to add a new action.
  2. Search for “iAuditor by SafetyCulture”.
  3. Select “Start Inspection Export (New)” for the action event.
  4. Click “Continue”.
  5. Add or associate your Gmail account using "+ Add a new account" button.

  6. Now you can export the export details of the Zap, these will be the components that are included in the email:
    Audit ID: Select from the “+” icon menu under Step 1.
    Document Type: The type of report to generate – select either a PDF or Word document.
    Report Preference (optional): Apply a previously created report preference setting to the inspection to make sure the report’s appearance remains consistent.
  7. Click “Test & Review”.
  8. After a successful test, click “Done Editing” and proceed to your next action.

Action: 5. Delay for

IMPORTANT NOTE

It is important in this case to have a delay added. The delay allows iAuditor to enough fully generate an inspection report and prevent failed exports or corrupted PDF/ Word files.

  1. Click “+” to add a new action.
  2. Choose “Delay” and “Delay For”.
  3. Add "10’" to the “Time Delayed For (value)" field and "Minutes" to the “Time Delayed For (unit)".
  4. Click “Test & Review” then click on “Done Editing” to proceed to your next action.

Action: 6. Get Inspection Report (New) in iAuditor by SafetyCulture

  1. Click “+” to add a new action.
  2. Search for “iAuditor by SafetyCulture” and select it.
  3. Choose “Get inspection report (new)” for the action event.
  4. Click “Continue”.
  5. Choose the same account that you used for the trigger action under “Choose account”.
  6. Under customize report, choose the following items:
    Audit ID: The unique ID of the Audit – select it from the “+” icon dropdown menu under Step 1.
    Export Task ID: The Message ID – select it from the “+” icon dropdown menu under Step 4.

Action: 7. Send Email in Gmail

  1. Click “+” to add a new action.
  2. Search for “Gmail” and select it. If this is your first Zap with Gmail, select “+ Add a New Account” with your login credentials - Otherwise, select your Gmail account from the page and click “CONTINUE”.
  3. Choose “Send Email” as the action event.
  4. Click “CONTINUE”.
  5. Enter the values for the following items to configure the email’s contents:
    To - The recipient of the automated emails containing the exported report.
    Cc (Optional) - If there are other email addresses that need to be cc’d to the message.
    Bcc (Optional) - If there are other email addresses that need to be cc’d to the message.
    From - The email address used to send the message containing the exported report.
    From name - The name that will be used as the sender of the automated message.
    Reply to (optional) - If there are other email address that the receiver can reply to other than your own.
    Subject - The automated message’s subject.
    Body type (Optional) - Message that you wish to include in the automated message’s body.
    Label/Mailbox - Specify which mail folder where the automated message should be sent to.
    Attachments - Choose “Audit Report: (Exists but not shown) – select it from the "+" icon dropdown menu under Step 6.
  6. Click "CONTINUE”.
  7. Click "Test & Review" and "Done Editing".
  8. Turn your zap on using the switch at the bottom of the screen.
Was this article helpful?

We love your feedback. Please tell us what you think.


Yes No
Care to share a bit more so we can continue to make improvements for you? Care to share a bit more so we can make this article even better for you? Thanks for your feedback!