Add qualified sales emails from Outlook to HubSpot
Build a Kovca workflow that starts from a new Outlook email, classifies it, and creates a HubSpot contact only when no matching contact is found.
Sales inquiries land in a shared Outlook inbox next to vendor pitches, support questions, and mail that is not a lead. Someone reads each message and copies the real prospects into HubSpot by hand. The same person sometimes creates a second contact for an address that is already there.
This guide builds a workflow that starts when a new email arrives, classifies the subject and the preview, and on a follow-up result searches HubSpot for the sender. When that search reports no match, it creates a contact with the sender's email. Any other result is left alone. You'll start from a template, test it, and activate it on the Outlook and HubSpot accounts.
The template already uses the Outlook New email trigger, HubSpot Search contacts, and HubSpot Create contact. It does not store an Outlook or HubSpot account. You choose the accounts when you activate. Until then the draft saves, and Studio tests simulate the HubSpot steps.
HubSpot in this product has actions and no triggers, so the workflow cannot start from a HubSpot event. Search contacts returns a total. Its sample result is { "total": 1 } and does not include a contact id. Update contact requires a contact id, so this template does not call it. A match is left as it is, which is how the workflow avoids a second contact. A search that reports zero matches is the only path that creates one.
If the shared inbox only gets a few sales emails a week, an Outlook rule that files those messages into one folder, and a person who copies the real ones into HubSpot, is less machinery than this. The workflow is for the inbox where sales mail sits with everything else.
What you'll build
Outlook: New email has no account. Lead text and Lead Intelligence follow it. Follow up? is the switch after that.
The followup branch reaches Search contacts. New contact? has a true branch to Create contact and a false branch to Result. Both HubSpot cards warn that no account is connected.
The default branch goes straight to Result. A message that is not a follow-up does not search HubSpot and does not create a contact. The false branch of New contact? also goes to Result, so a sender who already matches is not created again and is not updated.
Watch the test
Watch the Studio test (MP4). It is a recording of the production Studio at kovca.io, in light mode, 6 seconds. A caption under the picture reads: Studio test. Send real requests is off. Search contacts is a sample. Create contact is skipped. The clip is the Test tab after the pricing email, and that result stays on screen. Nothing is sped up. No Outlook or HubSpot account is connected, and Send real requests stays off.
The run returned 200 and used 5 credits. search is marked sample and succeeded. create is skipped. qualification is hot, intent is purchase_ready, recommended_action is prioritize_followup, search_total is 1, new_contact is false, and contact_id and created are null.
The recording follows these steps:
- The Test tab is open. The input is the pricing email: subject "Pricing for 40 licenses this quarter", preview asking for a quote for 40 licenses and to start this quarter, from
buyer@example.com. Send real requests is off. The switch's own text says action steps return their sample result and nothing is sent. - Run test. The status is 200. The panel shows 5 credits used for that one Decision AI step.
- The qualification is
hot, the intent ispurchase_ready, and the recommended action isprioritize_followup. The route isfollowup.missing_informationisbudgetandcompany. - Search contacts succeeded and is marked sample. Create contact is skipped.
search_totalis 1,new_contactis false, andcontact_idandcreatedare null. That output stays on screen through the end of the recording.
That is one live Studio test of that email. Search contacts returned its sample, whose total is 1, so New contact? took the false branch. Nothing was created in HubSpot. The JSON later in this guide is the template's unit test for the same input when the test provider does not read the message. In that test the qualification is warm and the recommended action is standard_followup. The route is still followup, the search total is still 1, and Create contact is still skipped. What Lead Intelligence returns on a live run depends on the message.
The same email, run from the Kovca CLI with kovca test and no --live-actions flag, printed the same live shape: hot, purchase_ready, prioritize_followup, search_total 1, new_contact false, created null, create skipped, and 5 credits. That command tests the draft the way the Studio Test tab does. It is not a published API call, and it does not send the HubSpot request.
kovca test of Outlook leads to HubSpot. create is skipped. The output is hot, purchase_ready, prioritize_followup, search_total 1, new_contact false, created null. 5 credits.
Build it in the Studio
1Start from the template
Click Use this template above, or open Outlook leads to HubSpot in Workflows.
The draft opens on the canvas. The components library is on the left. Triggers, AI, Action in an app, Data transformation, Flow, Core, and Human review are the groups. This workflow uses Outlook and HubSpot, so Outlook is under Triggers and HubSpot is under Action in an app. Apps you have not connected, and that this workflow does not use, stay behind Connect another app. The pictures below are the production Studio: that library, the New email settings, the HubSpot steps, and a test of the pricing email. The template's step titles are the ones in the table above. The last card on the canvas is Result. That is the output step.
The library home. Triggers says the workflow starts on Outlook: New email. Action in an app is one of the groups.
New email is selected. New Contact Added, calendar events, and New Sent Message are in the same list.
A search for HubSpot. The cards include Create contact, Update contact, and Search contacts. The panel cuts the longer card titles.
2The workflow starts from a new email
Select the input step. It is Outlook · New email, not an API request. The account line asks you to connect Outlook. Leave it empty while you test.
Connect Outlook is still to do. Only to is sales@example.com. Importance shows low until a value is applied. Only from and Subject contains are empty.
The template sets Only to (to_email) to sales@example.com. That value is a stand-in. Replace it with the shared inbox address. A live message that is not addressed to that address on the To line does not start a run. The Test tab and an API call send the event you provide, so they still run when the To line would not have matched.
The other settings are optional, and the template leaves them unset:
The Importance menu shows low until you choose a value and apply it. The template does not apply one, so it does not limit mail to low importance. Use Only to, or Only in folder, to point the trigger at the shared inbox. A subject filter is a poor fit here, because a sales email does not share one subject with the next one.
Event fields later steps read:
The event also includes message_id, received_at, conversation_id, web_link, has_attachments, and event_type. A manual run or an API call can omit fields the steps don't read. from is a JSON object, not an email address. The trigger's sample puts the address at from.email_address.address and the display name at from.email_address.name. This workflow reads the address only. It does not split the display name into a first name and a last name.
preview is the first part of the body, about the first 255 characters, as plain text. Lead Intelligence reads Lead text, which is the subject plus that preview. It does not see anything past the preview.
The same message does not start two runs: the event id is message_id. A later message is a new event and runs again.
3Write the message the node reads
Select Lead text. It builds Lead Intelligence's message from the subject and the preview.
The template is the subject, a blank line, and the preview.
message is required and accepts at most 4,000 characters. The subject and the preview together stay under that. An empty subject and an empty preview still produce the word Subject and a blank line, so the message is not empty.
4Classify the email
Select Lead Intelligence. message comes from Lead text. The criterion is a fixed value. Company, budget, timeline, product interest, and routing rules are left unset, because this event does not include them as their own fields.
message is nodes.inquiry.output.text. qualification_criteria is the fixed value for a message that asks to buy, to get a price, or to start a project. Company, budget, and timeline are not set.
Rewrite that sentence in your own words. criteria is a list of up to 10 items, each up to 300 characters. Each comes back as met, not_met, or unknown. A not_met result sets the fit to does_not_meet, and the action becomes nurture, so HubSpot is not called. An unknown result does not by itself stop a follow-up.
The node decides on fixed, published rules:
Near-term means the message or a mapped timeline says the purchase or project should start within about three months. This template does not map timeline. A phrase in the preview, such as "this quarter", is what the node can use. missing_information lists what was not supplied. For this template that is budget and company when the message does not state them, and timeline as well when nothing in the message is near-term.
Follow up? searches HubSpot only for prioritize_followup and standard_followup. nurture, request_information, and manual_review take default and leave the message alone. A vendor pitch and a support question are in that second group when the node calls them not_a_sales_inquiry or existing_customer_or_support.
5Decide what counts as a follow-up
Select Follow up?. The switch reads nodes.lead.output.recommended_action and continues on the first matching case.
Route on is nodes.lead.output.recommended_action. The followup case lists prioritize_followup and standard_followup.
The step's id is route. The case name is followup. The output field route is the branch that ran: followup or default.
6Search HubSpot for the sender
Select Search contacts. It runs only on followup. It is HubSpot's Search contacts action.
If it fails is Stop the run. Query is input.from.email_address.address. Limit is the fixed value 1.
Query is a text search across HubSpot's default searchable contact properties: first name, last name, email, phone, additional emails, the object id, a calculated phone number, and company. It is not a filter that matches the email property alone. The template puts the sender's address in Query so the address is the text HubSpot searches. The step's description mentions filter groups, sorting, and selected properties. This node does not have inputs for those. Its inputs are Query and Limit.
If it fails is Stop the run. The step is safe to retry: repeating a search has no further effect, and a transient failure can be tried again within the run. If the search does not succeed, the run stops and Create contact does not run. That avoids creating a contact when you could not tell whether one already matched. Choose the HubSpot account on this step before you activate. In a Studio test, with Send real requests off, the step returns its sample and is marked sample. The sample total is 1. The sample result is { "total": 1 }. There is no contact id in that sample.
7Create a contact only when the total is 0
Select New contact?. It reads nodes.search.output.total and continues on true when that total equals 0.
Continue on true when all rules match. nodes.search.output.total equals 0.
A missing total does not count as 0, so a search that did not return a total does not create a contact. With Send real requests off, the total is always the sample's 1, so Create contact is skipped on every Studio test. That skipped step is not a failed create. To see Create contact run, turn on Send real requests with a HubSpot account chosen, and use a sender address your portal does not already have.
Create contact is HubSpot's Create contact action. It is on the true branch.
If it fails is Stop the run. Email is input.from.email_address.address. First name and last name are not set.
Email is the only field the template sets. The event does not have a separate first name or last name, and the template does not guess them from from.email_address.name. Lifecycle stage is free text. The field's description gives examples such as Lead and Customer. The template does not set one, because it does not know which value your portal expects.
If it fails is Stop the run. The step is attempted once. It is not retried, because creating a contact again would add another contact. In a Studio test the step does not run while the sample total is 1, so you will not see its sample on that test. The sample contact id, when the step does return its sample, is 93847102. That is the action's sample, not a contact created in your portal.
Update contact is a separate HubSpot action. It needs a contact id, and Search contacts' sample does not include one, so this template does not add an Update contact step. A sender who already matches is left unchanged.
8Test it
Open the Test tab. Pricing request and Vendor pitch are the template's examples. Sample new email is the trigger's own sample, which is an overdue invoice, not one of these emails. Leave Send real requests off. Search contacts then returns its sample and is marked sample. Create contact is skipped, because that sample total is 1. Nothing is written to HubSpot.
The input is valid. Send real requests is off. Sample new email and Recent from Outlook are the trigger's buttons. The pasted subject is Pricing for 40 licenses this quarter.
The pictures' Test tab shows the pricing email pasted in. It also shows Sample new email, which loads the invoice. It does not show buttons named Pricing request and Vendor pitch: those names are saved with the template, and they are listed when you open the template.
What Lead Intelligence returns depends on the message. A prioritize_followup or standard_followup result takes Search contacts. With the sample total of 1, Create contact is skipped. nurture, request_information, and manual_review go to Result, and both HubSpot steps are skipped. search_total, new_contact, contact_id, and created come back null on the default branch.
Before you activate, run messages you have actually seen, including ones that should be follow-ups and ones that should not. When the routes look right, turn on Send real requests once, with both accounts chosen, on an address where a new HubSpot contact is harmless. Search contacts will run for real, and Create contact will run for real only when the total is 0.
Publish, call it, and activate it
The same workflow can be called over the API. The body uses the trigger's field names. Create an API key under API keys and keep it on your backend.
That curl calls a published workflow. On a follow-up result it runs Search contacts for real, and it runs Create contact for real when the total is 0. The steps need the HubSpot account on Search contacts and on Create contact, and the Outlook account on the trigger when an Outlook event is what starts the run. If an account is missing, the action fails. With If it fails set to stop, the run stops and Create contact does not run after a failed search. A published call does not return the sample you see with Send real requests off.
The JSON below is the output this template's unit test expects for the pricing email when the test does not read the message. It picks the first intent, so the intent is purchase_ready, and it does not treat the timeline as near-term, so the qualification is warm and the action is standard_followup. Search contacts and the condition still run. Create contact is skipped because the simulated total is 1. This is not a response from a published API call, and it is not the hot result on the Studio recording above.
The JSON above leaves out credits. A succeeded execute response includes that field. This example is the simulated run, so Search contacts is not charged and Create contact does not run. credits for an API call of this shape is 6: 5 for Lead Intelligence and 1 for the API run. The Studio test does not charge the run fee, which is why its panel shows 5.
Look up the run later. This returns status, timing, and steps. It does not return the output. Keep the execute response if you need the qualification or the contact id. Runs are kept for 30 days.
AAMkAGI2THVSAAA= is a key you choose. The message id is a natural one. Keys are kept for 24 hours. A retry with the same key and the same request returns the original run instead of searching again. A new key can search again. Create contact is not idempotent, so a later run whose search total is 0 can create another contact. Kovca does not store the message or the output.
To run it from the mailbox, open Activate. The checklist is what's left: connect Outlook, connect HubSpot, and, once an account is connected, choose that account on the trigger, on Search contacts, and on Create contact. It says up to 15 credits per event. The activate row is Publish and activate: run on every new email. The button on that row says Publish & activate. That publishes the draft and starts it. A live automation runs that pinned version. Later edits don't reach it until you publish them to the automation.
Connect Outlook and Connect HubSpot are still to do. Up to 15 credits per event. Publish and activate: run on every new email. The button says Publish & activate.
You sign in on Microsoft's page and on HubSpot's page. Kovca keeps an ID for each account. Connect them when the routes in the Test tab look right. Until then, leave the accounts empty and keep Send real requests off.
A new email that passes the trigger settings starts a run. Follow runs on the Runs page (filter by the workflow). While an automation is paused, messages that arrive are skipped. Kovca does not keep them to run later. A failed run is not retried on its own, because the contact may already have been created.
If someone already reads the inbox
You don't need this if a person can read the shared inbox and the volume is small. An Outlook rule can file matching recipients into one folder, and HubSpot is a fine place to type the contact by hand. A rule does not read the message, and it does not check whether the address is already a contact.
What the workflow adds is the same classification on every new email addressed to the inbox you set, a HubSpot search only when the recommended action is a follow-up, and a new contact only when that search total is 0. You still choose the accounts, replace sales@example.com, and read a sample of results before you activate it. A match is not updated, because this search does not hand back a contact id.
Make it yours
- Point Only to at the real inbox.
sales@example.comis a stand-in. Use the shared mailbox address, or set Only in folder once Outlook is connected and clear Only to if every message in that folder should run. - Rewrite the criterion. The sentence on Lead Intelligence is a fixed value. A criterion the message does not mention comes back
unknown, and that does not by itself create or skip the contact. Anot_metresult takesnurtureand skips HubSpot. - Leave researchers and pitches alone. That is already what
defaultdoes fornurture,request_information, andmanual_review. - Do not expect a Studio test to create the contact. The search sample total is 1, so Create contact is skipped. A real total of 0 is the create path.
- Add a name only when you have one. First name and last name are unset. Map them when the event actually carries them. Do not split
from.email_address.nameunless you have decided the rule. - Move the message only if you mean to. Outlook Move message (
action:outlook/move_message@1) takesmessage_idanddestination_id. The destination can be a folder id or a well-known name:inbox,deleteditems,drafts, orsentitems. This template does not move anything. Other results stay in the inbox. - Change it without surprising a live mailbox. Edit the draft and publish the changes to the automation. The running version stays pinned until you do.
What it costs
Credits, and only for steps that succeed. Billing is the list.
A Studio test skips the run fee. It does not skip Lead Intelligence. That step is 5 credits when it succeeds, including a test with Send real requests off. A simulated action is not charged, and an action that fails is not charged. A skipped action is not charged. With Send real requests off, Search contacts is simulated, so it adds nothing, and Create contact does not run.
- An Outlook event: 6 credits for the run.
- A published API call: 1 credit for the run.
- Lead Intelligence: 5 credits when it succeeds.
- Search contacts: 2 credits when it runs for real and succeeds. Only the follow-up branch is charged.
- Create contact: 2 credits when it runs for real and succeeds. Only the true branch, a search total of 0, is charged.
The switch, the condition, and the text step use no credits. A branch that doesn't run isn't charged. The Activate panel adds every step together, including the branch that does not run on the same event, so its number is an upper bound for a live event. With this template that upper bound is 15 credits per event: the 6 credit event fee, Lead Intelligence, Search contacts, and Create contact. A live event that searches and creates is those 15 when both actions succeed. A live event that searches and finds a match is 13 (the event fee, Lead Intelligence, and Search contacts). A live event that leaves the message alone is 11. A published API call is 10 when it creates, 8 when it searches and does not create, and 6 when it does not follow up. The response's credits field is the run's total. See the workflows API, HTTP actions, and automations.