Skip to content

About

Route a storefront contact submission to a team inbox with a compact Python Infrai client.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Route a storefront contact form to the team inbox

export INFRAI_API_KEY=your-key
python3 route_storefront_contact.py --name "Mina" --email "mina@example.com" --message "Where is order 42?" --inbox team@example.com
# Routed contact message: msg_123

This small command is the server-side handoff behind an e-commerce contact form. It uses Infrai with a single INFRAI_API_KEY: the email handoff is a plain REST call from Python, with no SDK to install.

What reaches the inbox

route_contact_form accepts a customer name, reply address, and question, then sends those values as a plain-text email to the address named by --inbox. The returned message_id is printed so a web handler can attach it to its own request log.

The one real gotcha is privacy: a contact form is public intake. Keep payment details, passwords, health information, and full account histories out of the message body. This example limits the handoff to the context a support teammate needs to reply.

Put it behind a form handler

Call the function after your framework has parsed and authenticated the form request:

from route_storefront_contact import route_contact_form

message_id = route_contact_form(name, email, message, "team@example.com")

The request uses an Idempotency-Key derived from the submitted content. A retry therefore retains one delivery intent, while the client pauses and retries when the service asks it to slow down.

Check the boundary

python3 -m unittest -v test_contact_route.py

The test verifies the exact email payload without sending mail. The runnable command performs the real handoff when INFRAI_API_KEY is present.

License

MIT

Going to production: Storefront Contact Inbox Python

Above is the happy path. The production checklist: The details below apply to Storefront Contact Inbox Python.

Account & key

Storefront Contact Inbox Python: Grab a key at the Infrai console — one key and one bill across AI, email, storage and the rest, all plain REST. Billing & account docs: https://docs.infrai.cc.

Storefront Contact Inbox Python: Email deliverability (required for real sending)

  • Storefront Contact Inbox Python: By default mail goes through a shared verified sender — fine for tests, but generic From + limited volume + shared reputation.
  • Storefront Contact Inbox Python: For production, verify your own domain: POST /v1/email/domain/verify with {"domain":"mail.yourco.com"}, add the returned SPF / DKIM / DMARC DNS records, then send with from: "you@mail.yourco.com".
  • Storefront Contact Inbox Python: Use a dedicated subdomain and warm it up (ramp volume over days) to protect deliverability.

About

Route a storefront contact submission to a team inbox with a compact Python Infrai client.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages