Email Collector

Process online receipts or invoices by sending them over veryfi email collector

Updated over a week ago

How it works

Veryfi Email collector allows you to automatically process and extract the documents sent to Veryfi email address assigned to your user account. Once an email hits Veryfi Email collector service, it extracts and processes both the attachments and the email body and returns you JSON with the extracted data as well as adds processed document directly to your Veryfi Inbox. It supports various file formats [PDFs, image files, HTML].

Email collector uses asynchronous processing method. In asynchronous processing, the user initiates a request but does not wait for an immediate response. Asynchronous processing typically involves the use of callbacks (webhooks). When the task completion occurs, a callback function notifies user upon processing.

Currently, Email collector supports only Receipts/Invoices endpoint:

https://api.veryfi.com/api/v8/partner/documents

✏️ Learn more about other processing methods and different endpoints in Veryfi API Docs


Supported Email Formats

  1. HTML

  2. Plain Text

  3. PDF

  4. Image Attachment

📚 Learn more about file formats supported and file requirements and what impact they have on the data extraction accuracy.

Where do I find my veryfi.cc email?

There are two places where you can find your @veryfi.cc email

  1. Just press COLLECT and you will see the assigned email to your account from any page inside your Veryfi portal.

2. Email Collector section under Settings

How Veryfi notify that Email got processed

1. Webhook

📚Read more about webhooks and asynchronous processing here or check API Documentation.

2. Email confirmation

Emails with confirmation that your email submission has been processed can be managed inside Profile settings.

Please go to Settings>Profile>AUTO-FORWARD EMAILED RECEIPTS & BILLS BACK TO ME? Toggle OFF/ON.


What is expected for emails with multiple attachments

All attachments will be combined into one PDF and will be processed as one transaction.

If you want attachments be processed as separate transactions, you can add #bulkupload hashtag to the email subject line and Veryfi will process all attachments as separate documents. This could help if you need it for some special cases.

If your want Veryfi to process all attachments separately all the time, you can request to set it account-wide by contacting support@veryfi.com.

How to customize the veryfi.cc email address

Currently, assigned veryfi.cc addresses can not be customized on user side. Please contact support@veryfi.com and we will be happy to help.

📍 If you need to customize the veryfi.cc email address for a primary/main user, it will require an API keys reset, so make sure you plan the maintenance window ahead.

How to retrieve email keys to JSON

While there is no specific field in Veryfi JSON that would return (capture) the metadata from a submission via email collector [like: subject, email_from, email_to, email_cc].

The workaround is to use Data Transformation Rules to pull that metadata to notes field.

You can find Rules section under Data Transformation in your Veryfi portal.

📍 There are other keys that you can utilize for that rule with {EmailedReceipt.email_..... } criteria:
.email_from {EmailedReceipt.email_from}
.email_to {EmailedReceipt.email_to}
.email_cc {EmailedReceipt.email_cc}
.subject {EmailedReceipt.subject}

Option with notes field

notes field is available by default for all users, so you can build this rule anytime. A blocker could be if you already use notes field for a custom regular expression, a new rule added to the same field will overwrite the previous extraction results.

How to create a rule

  1. Go to Veryfi portal> Data Transformation > Rules

  2. Hit Add Rule

  3. Set Condition & Action

  4. Set Rule Live

Where:
Condition: ALL Documents
Action: Apply to Notes
Notes apply: {EmailedReceipt.email_from}

What is expected:

The rule will pull the sender_email to your JSON notes section

Example:

How to get “forwarded from” email address?

1. Veryfi Email collector

2. Convert to HTML and send to Veryfi API directly.

1. Veryfi Email collector

Auto-forward all emails to Veryfi.cc (no code solution)


In this case “forwarded from” would be impossible to capture. The only option, in this case, is if the client adds a tag to the subject line with their end user email address.

Auto-forward all emails to Veryfi.cc ( programmatically )

This approach will require you to have direct integration of your mailbox and API.
The majority of the mailboxes have the ability to set custom headers. [These headers can be used for specific purposes, such as categorizing emails or adding additional tracking information] So you can set these custom headers to parse the sender email address, and when the client forwards the email we will identify this custom header and pull to external_id field.

Custom email header

An email header is a set of metadata that provides information about the email itself. It is not visible to the recipient by default, but it contains essential information for the email to be properly routed and processed. Email headers are generated by the email client or server and include details such as sender and recipient addresses, subject line, date and time sent, and various technical information.

To customize an email header, you typically need access to the settings of your email client or server. Keep in mind that modifying email headers is generally more advanced and might require technical knowledge, as altering certain headers improperly could result in emails not being delivered correctly or being flagged as suspicious.

Here is Python code sample for your referenced

To add a custom header when forwarding an email using Python, you can use the `add_header()` method of the `email.message.Message` class.

Here's an example:

import smtplib
from email.message import EmailMessage

# Create a new email message
msg = EmailMessage()

# Load the original email to be forwarded
original_email = ... # load the original email using your preferred method

# Set the custom header
msg.add_header('X-External-ID', '<ExternalID>')
msg.add_header('X-Bulk','<true/false>')
# Transfer the original email content to the new email
msg.attach(original_email)

# Forward the email
with smtplib.SMTP('smtp.example.com', 587) as server:
server.login('username', 'password')
server.send_message(msg)

Where

  • the `add_header()` method is used to add a custom header called X-External-ID with the value <ExternalID>. - for the purpose of pulling the value from the external id header to Veryfi JSON field external_id.

  • the `add_header()` method is used to add a custom header called X-Bulk with the value <true/false> - to process all email attachments separately.

2. Convert Email to HTML and send to Veryfi API directly

Another option is to pass the sender email if you integrate your mailbox directly to your API and send all emails directly to Veryfi API avoiding Email collector. In this case, the you can simply pass the email as an external_id field.

Please note that if the email collector is avoided you will need to do spam and other filtering efforts on your side. Also, this will be synchronously processed as opposed to asynchronous processing via email collector.

Pre-fill the document Tag with subject line #hashtags

Add a tag to your emailed receipt subject line using hashtags and Veryfi will apply a corresponding document level tag to the document.

Use the following format: #breakfast or #"nyc trip 2020"

Note: If the tag consists of more than one word wrap the tag name into double quotes e.g: #"nyc trip 2020" .


Please note:

  • It is expected to work only in case if a corresponding tag exists inside your Veryfi account.

  • If tag does not exists in your Veryfi account list of tags Veryfi will not create a new one and apply the tag from the subject line.

Tags section can be found under Data Transformation> Tags section in your left side navigation menu

📚 Please check the API Docs for the up-to-date API schema to learn how to manage Tags via API

If you experience any problems or need help setting this up, please reach out to support@veryfi.com, we are here for you.

Did this answer your question?