diff --git a/scripts/workers/create_trucking_fueltax_newsletter.py b/scripts/workers/create_trucking_fueltax_newsletter.py new file mode 100644 index 0000000..5bb010e --- /dev/null +++ b/scripts/workers/create_trucking_fueltax_newsletter.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python3 +""" +create_trucking_fueltax_newsletter.py — One-off trucking NEWSLETTER hooked on the +FreightWaves story about Prime Inc. suing the IRS over reefer-diesel fuel tax. + +Angle : industry news + a "keep your fuel records" call to action, because the + federal fuel-excise credit Prime is fighting for (diesel burned by a + refrigeration unit isn't used to propel a highway vehicle) is one small + carriers can claim too -- and records are what position a carrier to + recover money if a class action follows. +Links : (1) the FreightWaves article, (2) our free DOT compliance check tool. + BOTH are STATIC URLs, so @TrackLink is safe here (the @TrackLink 404 bug + was specific to PER-SUBSCRIBER hrefs like ?dot={{...}} where Listmonk + captured the URL before the token rendered). Static links register one + redirect for everyone -- exactly what we want for click counts. +Fine print: Performance West is a filing service, NOT a law firm or tax advisor. + +Creates the campaign in Listmonk as a DRAFT. Sending is a separate, manual, +STOP-and-confirm step (deliverability-sensitive: review audience + timing first). + + python3 scripts/workers/create_trucking_fueltax_newsletter.py --list + python3 scripts/workers/create_trucking_fueltax_newsletter.py --list --preview-only +""" +import argparse +import os +import sys + +_REPO = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +if _REPO not in sys.path: + sys.path.insert(0, _REPO) + +from scripts._email_plaintext import html_to_text # noqa: E402 +from scripts.workers.campaign_helpers import create_campaign # noqa: E402 + +# ── Links ──────────────────────────────────────────────────────────────────── +ARTICLE_URL = ( + "https://www.freightwaves.com/news/" + "prime-is-suing-the-irs-for-11-million-over-fuel-tax-it-paid-on-reefer-diesel-" + "the-same-credit-it-is-fighting-for-is-one-small-carriers-can-claim-too" +) +DOT_CHECK_URL = "https://performancewest.net/tools/dot-compliance-check" +SITE = "https://performancewest.net" + +EMAIL = "info@performancewest.net" +PHONE_TEL = "+18884110383" +PHONE_DISPLAY = "(888) 411-0383" + +# Listmonk click tracking: a link is only registered (and clicks recorded) when +# its href ends with the literal "@TrackLink" marker. We also append UTM params so +# Umami attributes the visit too. SAFE here because both target URLs are static. +UTM_BASE = "utm_source=listmonk&utm_medium=email&utm_campaign=trucking-fueltax-newsletter" + + +def _track(url: str, content: str) -> str: + sep = "&" if "?" in url else "?" + return f"{url}{sep}{UTM_BASE}&utm_content={content}@TrackLink" + + +# ── Trucking-branded HTML helpers (navy #1a2744 / orange #f97316), matching the +# proven trucking campaign chrome (campaign 179). ─────────────────────────── +FONT = "Inter,system-ui,Arial,sans-serif" + + +def header(eyebrow, headline): + return ( + '' + f'Performance West' + f'

{eyebrow}

' + f'

{headline}

' + '' + ) + + +def P(t): + return f'

{t}

' + + +def H2(t): + return f'

{t}

' + + +def UL(*items): + lis = "".join( + f'
  • {i}
  • ' for i in items + ) + return ( + f'' + ) + + +def quote(t): + return ( + '' + '
    {t}
    ' + ) + + +def cta(text, url, color="#f97316"): + return ( + '' + '
    ' + f'{text}' + '
    ' + ) + + +def disclaimer(): + return ( + '' + '
    ' + f'

    ' + 'Please note: Performance West is a DOT compliance and ' + 'filing service — we are not a law firm and not a tax advisor, and nothing in ' + 'this email is legal or tax advice. This is industry news. Whether your reefer or PTO fuel qualifies for ' + 'a federal fuel-tax credit, and whether to join any lawsuit or class action, depends on your specific ' + 'situation — please talk to a qualified tax professional or attorney before filing a claim or ' + 'taking action.

    ' + ) + + +def dot_check_block(): + return ( + '' + '
    ' + f'

    ' + 'While you’re thinking about records — is your DOT compliance current?

    ' + f'

    ' + 'Run our free DOT compliance check: enter your USDOT number and we’ll show you ' + 'what’s due — MCS-150 biennial update, UCR, BOC-3 and more. No charge, no obligation.

    ' + + cta("Run my free DOT check →", _track(DOT_CHECK_URL, "dotcheck"), color="#1e40af") + + '
    ' + ) + + +def footer(): + return ( + '' + f'' + '
    ' + f'

    ' + f'Questions? Reply to this email, write {EMAIL} ' + f'or call {PHONE_DISPLAY}.

    ' + '
    ' + f'

    Performance West Inc. · ' + '525 Randall Ave Ste 100-1195, Cheyenne, WY 82001 · ' + f'performancewest.net

    ' + '

    ' + 'Unsubscribe

    ' + '' + ) + + +def build_body(): + inner = ( + P("There’s a fuel-tax story moving through trucking right now that could mean money back in your " + "pocket — not just for reefer haulers, but for anyone whose diesel runs equipment that " + "doesn’t move the truck. We wanted to put it in front of you.") + + quote( + "FreightWaves reports that Prime Inc. is suing the IRS for about " + "$11 million over federal excise tax it paid on diesel burned by its " + "refrigerated (reefer) trailer units. Prime’s argument: diesel used to run " + "a reefer unit isn’t used to propel a truck down the highway, so it shouldn’t carry the " + "federal on-highway fuel tax — and the same credit it’s fighting for is one that small " + "carriers can claim too." + ) + + H2("This isn’t just a reefer issue") + + P("The federal excise tax on diesel is about 24.3 cents a gallon, and it’s " + "meant to pay for diesel that propels a vehicle down the highway. The thing is, a lot of " + "the diesel you buy never turns a wheel:") + + UL( + "Reefer units — the fuel a refrigerated trailer burns keeping a load cold", + "Power take-off (PTO) and auxiliary equipment — dump-truck hydraulics, " + "cement mixers, bucket / boom / digger derricks, pumpers, blowers, refuse packers, sweepers, " + "wreckers, and other equipment your engine runs while the truck sits still", + "Other off-highway / non-propulsion use — idling auxiliary power and " + "equipment that runs off the same tank", + ) + + P("Diesel used for those purposes generally isn’t propelling a highway vehicle, " + "so it may not owe the federal on-highway fuel tax — and the tax you already paid on it may be " + "refundable on IRS Form 4136 (or via Form 8849). That is the same off-highway credit " + "Prime is fighting for on its reefer fuel.") + + P("Over a year of runs that adds up — and if a class action follows Prime’s lawsuit, the " + "carriers who kept clean records will be the ones positioned to claim their share.") + + H2("What to do now: gather and keep your fuel records") + + P("You don’t need to do anything drastic today. The single most important thing is simple: " + "don’t throw your fuel records away, and start keeping them organized.") + + UL( + "Save your fuel receipts and IFTA fuel summaries — especially anything that " + "separates reefer or PTO fuel from the fuel that moves the truck", + "If you can, track that fuel separately — a dedicated fuel card, pump, or " + "tank reading for the reefer / PTO equipment makes this much easier to prove later", + "Hold onto reefer run logs, PTO / engine hours, or equipment-meter readings if " + "your unit records them", + "Keep everything by quarter and by year — the cleaner the paper trail, the " + "stronger any future claim", + ) + + P("If a class action or a clearer IRS position emerges, the carriers with documentation in hand will " + "be the ones ready to act.") + + cta("Read the full story on FreightWaves →", _track(ARTICLE_URL, "article")) + + disclaimer() + + dot_check_block() + + P("Drive safe out there,") + + P("Justin Hannah
    Performance West Inc.
    " + f'DOT Compliance Services') + ) + return ( + '' + '' + '' + '
    ' + '' + '
    ' + '' + + header("Industry News · Fuel Tax", + "Prime is suing the IRS for $11M over reefer fuel tax — " + "and the same credit may apply to your reefer or PTO fuel") + + '' + + footer() + + '
    ' + ) + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--list", type=int, help="Listmonk list id to target (the newsletter audience)") + ap.add_argument("--name", default="Trucking Newsletter \u2014 Reefer/PTO Fuel-Tax Story + Keep Your Records") + ap.add_argument("--subject", + default="Are you owed a refund on the fuel tax you paid for your reefer or PTO?") + ap.add_argument("--preview-only", action="store_true", + help="write the rendered HTML to /tmp and do NOT touch Listmonk") + args = ap.parse_args() + + body = build_body() + altbody = html_to_text(body) + + out = "/tmp/trucking_fueltax_newsletter.html" + with open(out, "w") as f: + f.write(body) + print(f"Rendered preview -> {out}") + print(f"Body: {len(body):,} chars HTML / {len(altbody):,} chars plaintext") + + if args.preview_only: + return 0 + if not args.list: + print("\nNo --list given; created preview only. Re-run with --list to create the draft.", + file=sys.stderr) + return 0 + + print(f"\n=== Creating trucking fuel-tax newsletter (DRAFT, list {args.list}) ===") + cid = create_campaign(args.name, args.subject, [args.list], body, altbody=altbody, status="draft") + if cid: + print(f"\nDraft created (id {cid}). Review/preview in Listmonk, then send manually.") + return 0 if cid else 1 + + +if __name__ == "__main__": + raise SystemExit(main())