New driver's CDL read, logged and checked for expiry
A new driver's CDL is emailed in. Textract reads the license number, class and expiry, the license is logged in a Google Sheet, and any problem goes to the safety manager first.
The prompt
When a driver's CDL is emailed to our safety inbox in Gmail, read the name, license number, state, class, endorsements, restrictions and expiry date. If the license is expired, expires in the next 60 days, isn't class A or B, or the read isn't clear, ask the safety manager in Slack with Cleared to drive and Hold off dispatch buttons and wait for the answer. Then log the license in our driver license Google Sheet, updating the driver's row if the license number is already there, with a status that says what the safety manager decided.
FlowRunner Prompt to Flow built this flow from that request. Here it is as it opens in the editor.
The flow
Download the file, then in FlowRunner click + beside Flows, pick it under Import a Flow Version and click Create. How importing works
What each step does
- New CDL email Checks your Gmail inbox every 5 minutes for an email with CDL or driver license in the subject, and saves the attached license.
- Read the CDL Textract reads the front of the license: name, license number, state, class, endorsements, restrictions and expiry date, each with how sure it is. A file it can't read goes to the safety channel in Slack.
- Check the license Counts the days left before the license expires and checks its class against the classes you hire for.
- License good to log? A license in date past your flag window, in the right class and read with confidence goes straight to the log.
- Ask the safety manager An expired license, one close to expiry, the wrong class or an unclear read goes to the safety manager in Slack with what was read, what's wrong, a link to the file, and two buttons, Cleared to drive and Hold off dispatch.
- Wait for the safety manager's answer The run waits for the click, and the answer goes into the log as the license's status.
- Find the driver in the log Looks the license number up in your driver license sheet.
- Add the driver to the log A new license number adds a row with the name, number, state, class, endorsements, restrictions, expiry, status, the date checked and a link to the email. A number already in the sheet updates that row instead, so a renewal replaces the old expiry.
Before you turn it on
- Connect your Gmail, Google Sheets and Slack accounts, and enter your AWS access key, secret key and region in the AWS Textract settings.
- Make a Google Sheet whose first tab has these headers in row 1: Driver, License number, State, Class, Endorsements, Restrictions, Expires, Status, Checked, Emailed by and Email. Format the License number column as plain text. Put the sheet's URL or ID in the flow setting Driver license sheet.
- Copy the URL of the block Wait for the safety manager's answer into the flow setting Answer link. The Slack buttons open it.
- Change Days before expiry to flag (60), CDL classes accepted (A,B) and Minimum read confidence (90) if yours differ.
- Pick your safety Slack channel in Send unreadable CDL to safety and Ask the safety manager.
- Textract reads the front of a U.S. driver's license from the email's first attachment, one photo or one-page PDF up to about 5 MB.