TextPreflightGuide
Pre-send automation

Turn SMS cost rules into a release gate.

Run deterministic checks after rendering and before delivery. Warn, require approval or stop the send when the encoded result violates your policy.

Place the check at the right point

  1. Render the final message with production variables.
  2. Analyze encoding, Unicode findings and segments.
  3. Apply your own thresholds.
  4. Show a human-readable reason when review is required.
  5. Create the delivery request only after the policy passes.

A minimal JavaScript gate

const result = await textpreflight.analyze({
  text: renderedMessage,
  recipients,
  unitPrice,
  currency: "USD"
});

if (result.data.segments.count > 2) {
  throw new Error("SMS requires cost review");
}

if (result.data.unicode.riskLevel === "high") {
  throw new Error("SMS contains a high-risk Unicode finding");
}

Prefer policy over silent rewriting

Typography-only replacements can reduce cost, but automatic rewriting is not appropriate for every language or message. Keep optimization inspectable. Store the policy decision and request identifier—not the private message body—when you need an audit trail.

Useful policy examples

Keep delivery providers replaceable.

A preflight gate that runs before delivery keeps cost and safety rules separate from a particular provider integration.

Protect the next send.

Turn the fields that matter to your product into explicit rules.