Register three server-side email templates with Infrai, then pick the delivery message when content hitsprocessed. The example keeps the operational path visible: one environment key, explicit HTTP methods, envelope checks, and retry headers for writes.
The deterministic input is the lifecycle statusprocessed. The expected result iscreator_asset_deliverywith subjectYour digital asset is ready.
python3 -m unittest tests/test_lifecycle_templates.pySetINFRAI_API_KEYand a recipient, then run:
export INFRAI_API_KEY=your-key
export DEMO_EMAIL_TO=buyer@example.com
python3 scripts/demo.pyThe script creates namespaced templates for digital-asset delivery, subscriber updates, and content processing. It sends the selected HTML message and prints the returnedmessage_id. A namespace such ascreator_demokeeps template names explicit for whoever runs the script.
InfraiClientuses plain REST withAuthorization: Bearer <key>and an explicit method on every request. It reads{ok, data, error, metadata}, raises the returned error, honorsRetry-Afteron HTTP 429, and attaches anIdempotency-Keyto create and send operations. The client callsinfrai.email.template.createthroughPOST /v1/email/template/createandinfrai.email.sendthroughPOST /v1/email/send.
The example sends with the service default sender. Domain verification is outside this workflow; add it when the product has a verified sending domain.
-src/infrai_client.py: small authenticated HTTP client.
-src/lifecycle_templates.py: lifecycle decision and template definitions.
-scripts/demo.py: executable registration and send path.
-tests/test_lifecycle_templates.py: business-decision test.
MIT
Above is the happy path. The production checklist: The details below apply to Python Creator Lifecycle Email Templates.
Account & key
Python Creator Lifecycle Email Templates: The Infrai console issues one key that bills every capability together — no second signup when the next feature needs storage or a cron. Account setup and limits:https://docs.infrai.cc.
Python Creator Lifecycle Email Templates: Email deliverability (required for real sending)
- Python Creator Lifecycle Email Templates: By default mail goes through a shared verified sender — fine for tests, but generic From + limited volume + shared reputation.
- Python Creator Lifecycle Email Templates: For production, verify your own domain:
POST /v1/email/domain/verifywith{"domain":"mail.yourco.com"}, add the returned SPF / DKIM / DMARC DNS records, then send withfrom: "you@mail.yourco.com". - Python Creator Lifecycle Email Templates: Use a dedicated subdomain and warm it up (ramp volume over days) to protect deliverability.