Email workspacePolicy created — Curasel-triggered API body
Source: App\Mail\insuranceActivity (preserve class case/spelling), app/Mail/insuranceActivity.php; resources/views/emails/insuranceActivity.blade.php using mail::message. This older body is separate from the NewInsurancePolicy/order-status workflow. Native subject is the constructor title, currently Policy Created at the traced call. Suggested preheader: the same supplied title.
| Token | Existing source | Handling |
|---|---|---|
| {{activity_title}} | Constructor title, currently 'Policy Created' | Required complete escaped title and native subject. Do not silently replace or infer another event. |
| {{activity_description}} | Constructor description | Required complete escaped text. The caller already builds 'Dear customer, your insurance policy was created. Amount due ' + order.currency + number_format(order.amount_due), with default **zero decimals**. Preserve the assembled string; do not parse/recalculate/reformat it or add a separate guessed amount/token. |
| {{preheader}} | Existing supplied title | Escaped text; no invented policy ID, coverage date or payment/approval claim. |
The source body only renders these two constructor strings. It does not receive customer first name, policy ID, bank details, provider identity, claim information or a workflow URL. Do not invent them. The source has no Thanks/app-name sign-off; common footer is the separately approved shared policy. Default logo/optional {{logo_url}} and actual PNG/CID/approved HTTPS requirements: [shared-footer](../shared-footer.md). No optional body sections, separate legacy duplicate link fields, attachment or PDF exists.
Trigger, recipients and unresolved source context
CuraselConrtroller::handleWebHook (:65–149), route POST curacel/webhook (routes/api.php:176), handles strict event policy.created when data.id and customer are truthy. It creates the original InsuranceActivity and may perform existing wallet/ledger/commit work when the supplied order is paid and a matching older InsurancePolicy is found. It then constructs description and calls Mail::to(customer.email)->send(new insuranceActivity('Policy Created', description)) at :145.
Preserve customer-email routing, exact constructor strings, native send(), subject and configured From/Reply-To (no explicit overrides), plus all original callback/debit/error behavior. The source checks optional order for paid-work processing, but later dereferences order.currency/amount_due while constructing description without establishing an unconditional order guard. Missing-order behavior is an unresolved application concern, not a reason to fabricate an email amount/description. No missing-order delivered-email state is asserted in this library.
The existing description says Amount due even when the callback order reports paid; retain that source text and do not change it into verified paid/settled/covered. This is an API-authored body with an external trigger, not an externally authored CRM campaign. Do not merge old InsurancePolicy data with NewInsurancePolicy or the separate completed-order email. Actual callback idempotence, debit/record correctness and external policy eligibility are outside HTML scope.
Integration and safety
Use the existing Mailable with a complete HTML Blade view and proposed plain-text alternative. Portable {{placeholder_name}} tokens are not automatically Blade. Escape complete title/description and attributes, preserve meaningful line breaks, validate image overrides separately and use one pass for replacement. The original {{description}} expression already escapes text; do not start trusting raw HTML or recursively evaluating token-shaped strings. No new framework is needed.
Four fictional states cover normal description, supplied zero amount-due text, multiline text as a view check and long title/description. No real webhook/customer record is used. Files: public/ready/insurance-policy-created.html/.txt and previews/insurance-policy-created-*.html/.txt. No separate per-email project-owned text source found. Browser checks do not establish actual provider status/coverage, debit/payment correctness, email-client/CID behavior or current production sending.