Initial Outreach Logic
Our initial outreach process involves sending a new email to a Contact, usually related to a Property. Sending is based on the configuration of the associated BlastContact record. Here's a high-level overview of the logic:
Steps
- Retrieve the
BlastContactrecord by ID and validate its status. - Validate the
BlastContactdata, including:- Follow-up date: Must be within the past 30 calendar days.
- Property details: Check against blocked properties, cities, and states, as well as properties we own.
- Contact details: Ensure email and first name are present.
- Outlook login credentials: Confirm the sending
OutlookLoginis signed in with valid credentials. - Script details: Check that the script is properly filled in.
- Do Not Contact (DNC) list.
- Build the email subject and body from the associated script and script variants.
- Generate the email signature.
- Send a new email using the Outlook login credentials.
- Update the
BlastContactrecord:- Set the
LastContactedtimestamp. - If the
NextScriptis not set, and the status is not "failed", mark the record as completed. - Otherwise, find the next script based on the
NextScriptIDfield and associate ID. - Update the
BlastContactrecord with the new script details and status.
- Set the
- Handle any errors that occur during the process:
- Update the
BlastContactstatus and failure reason based on the error type. - If the error is related to an invalid sender or expired follow-up, handle it accordingly.
- If the error is related to a failed token refresh, update the Outlook login credentials.
- Update the