email trust signals: add data-safety + guarantee + social-proof strip to HC, telecom (campaign_template), and trucking (6 source + active campaigns via injector). Vertical accents: teal/blue/orange

This commit is contained in:
justin 2026-06-06 04:13:16 -05:00
parent 95698852ce
commit 53ec011198
8 changed files with 196 additions and 10 deletions

View file

@ -0,0 +1,76 @@
#!/usr/bin/env python3
"""Inject a trucking-appropriate trust strip into the trucking source-template
campaigns in the trucking Listmonk DB (the ones the nightly builder clones).
Idempotent: skips campaigns that already have the strip. Run on the host.
"""
import subprocess, sys
SOURCE_IDS = [271, 272, 273, 274, 309, 310]
MARKER = "pw-trust-strip-v1"
# Trucking trust strip — data-safety + guarantee + social proof. Matches site.
STRIP = (
'<!-- ' + MARKER + ' -->'
'<table role="presentation" width="100%" cellpadding="0" cellspacing="0" '
'style="margin:18px 0 6px;border-top:1px solid #e5e7eb;padding-top:14px">'
'<tr><td align="center" style="padding:8px 4px;font-family:Inter,system-ui,sans-serif">'
'<span style="display:inline-block;margin:0 7px;font-size:11px;font-weight:600;color:#c2410c">&#128737;&#65039; SOC 2 Type II hosting</span>'
'<span style="display:inline-block;margin:0 7px;font-size:11px;font-weight:600;color:#c2410c">&#128274; 256-bit TLS encrypted</span>'
'<span style="display:inline-block;margin:0 7px;font-size:11px;font-weight:600;color:#c2410c">&#128179; Secure payment by Stripe</span>'
'<span style="display:inline-block;margin:0 7px;font-size:11px;font-weight:600;color:#c2410c">&#9989; SSL Labs A+ rated</span>'
'</td></tr>'
'<tr><td align="center" style="padding:2px 4px 8px;font-family:Inter,system-ui,sans-serif;font-size:12px;color:#475569">'
'<strong style="color:#c2410c">100% satisfaction guarantee</strong> &middot; fixed pricing, no billable hours &middot; trusted by thousands of carriers nationwide'
'</td></tr></table>'
)
def psql(sql, fetch=False):
cmd = ["docker", "exec", "-i", "performancewest-api-postgres-1",
"psql", "-U", "pw", "-d", "listmonk", "-tAc", sql]
r = subprocess.run(["sudo"] + cmd, capture_output=True, text=True)
if r.returncode != 0:
print("PSQL ERR:", r.stderr[:200]); sys.exit(1)
return r.stdout.strip()
def set_body(cid, body):
# write body via a file to avoid shell-escaping a huge HTML blob
import tempfile, os
with tempfile.NamedTemporaryFile("w", suffix=".sql", delete=False) as f:
# use dollar-quoting
f.write(f"UPDATE campaigns SET body = $PWBODY${body}$PWBODY$ WHERE id = {cid};")
path = f.name
subprocess.run(["sudo", "docker", "cp", path, "performancewest-api-postgres-1:/tmp/u.sql"], check=True)
r = subprocess.run(["sudo", "docker", "exec", "performancewest-api-postgres-1",
"psql", "-U", "pw", "-d", "listmonk", "-f", "/tmp/u.sql"],
capture_output=True, text=True)
os.unlink(path)
return "UPDATE 1" in r.stdout
def main():
for cid in SOURCE_IDS:
body = psql(f"select body from campaigns where id={cid};")
if not body:
print(f" {cid}: NOT FOUND, skip"); continue
if MARKER in body:
print(f" {cid}: already has trust strip, skip"); continue
# Inject right before the final footer block. Anchor: the
# '<div style="text-align:center;padding:16px;font-size:11px' footer line,
# else before the last </div></div> close.
anchor = '<div style="text-align:center;padding:16px;font-size:11px'
if anchor in body:
new = body.replace(anchor, STRIP + anchor, 1)
else:
# fallback: before the very last </div>
idx = body.rfind("</div>")
new = body[:idx] + STRIP + body[idx:] if idx != -1 else body + STRIP
if set_body(cid, new):
print(f" {cid}: trust strip injected")
else:
print(f" {cid}: UPDATE failed")
if __name__ == "__main__":
main()