Solution
The idea was to integrate various APIs, such as Cooper CRM, Atlassian Jira, Google Gmail, and G Suite. Messages from all sources are aggregated in one email address, where they wait to be processed with our module. The task of checking the inbox is run every 15 minutes.

Accessing Gmail inbox through API requires user consent. Service accounts can bypass this with domain-wide authority. Such accounts can be created by the admin in G suite and allow us to manage messages inside the chosen inbox.
Aggregation of mailboxes may cause a massive amount of messages in one inbox, we have already had over a hundred thousand in ours. To avoid processing through the whole mailbox, the specific query has to be used. For this purpose, it has to check if emails were forwarded from a selected list of mailboxes (for example, hr@bravelab.io or other used aliases). To narrow results further, only messages from the last seven days that haven't been processed yet, are considered. From such a list, data from each email is used to create a new candidate with linked leads. Leads are used later for integration with Cooper CRM and Atlassian Jira. To avoid making many duplicates, only the first email in the thread is allowed to create a new candidate. These criteria allow applicants to apply for multiple positions, or to reapply later.
How does it work
When email awaiting processing is found, a sequence of things happen. The message list returned from the query contains only message ids and thread ids. In Gmail API, if they are the same, it means it's the first message in a thread. Then all needed information is extracted from such a message. From the header “From” name and email address are extracted. From message content, regular expressions look for phone numbers. And from “parts” we extract attachment id’s and get all attachments. The message subject is also extracted. Such information is passed to the candidate management script.
Candidates in the recruitment tab hold’s all information in a user-friendly way.

But for integration with other API’s we use an already utilized lead system. Each instance has related one of each: an email message, profile, and lead.
Interactive URLs allow for quick access to inbox and candidates as needed. New leads create issues on Jira:

Notification appears on slack:

And they are added to Copper CRM:



Conclusion
System of notification, automatic gathering, and pre-processing candidates improves speed and efficiency of the recruitment process.
