Initial Outreach
Logic

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

  1. Retrieve the BlastContact record by ID and validate its status.
  2. Validate the BlastContact data, 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 OutlookLogin is signed in with valid credentials.
    • Script details: Check that the script is properly filled in.
    • Do Not Contact (DNC) list.
  3. Build the email subject and body from the associated script and script variants.
  4. Generate the email signature.
  5. Send a new email using the Outlook login credentials.
  6. Update the BlastContact record:
    • Set the LastContacted timestamp.
    • If the NextScript is not set, and the status is not "failed", mark the record as completed.
    • Otherwise, find the next script based on the NextScriptID field and associate ID.
    • Update the BlastContact record with the new script details and status.
  7. Handle any errors that occur during the process:
    • Update the BlastContact status 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.