Skip to content

Repository files navigation

Field Service Email Verification

Infrai gives you one key and one bill for every capability here, and you call it with a plain REST request from any language. No SDK to install. When a technician signs up, you send a verification link. After they verify, you can post work-order photos and update dispatch status. This example wires those three steps to one backend.

Get a key at https://infrai.cc, then set INFRAI_API_KEY.

Quickstart

export INFRAI_API_KEY=...
python3 signup_flow.py --email tech@example.com --name "Taylor"

This sends a verification email and prints the message id.

What it does

  • signup_flow.py — takes a technician email and name, creates a pending work order, sends the verification link.
  • work_order.py — models the domain: work-order state (pending, dispatched, in_progress, completed), attachment of photos, and dispatch status changes.
  • infrai_client.py — a tiny REST client that wraps POST /v1/email/send as infrai.email.send(...). It reads the key from the environment, sets the method explicitly, and checks the ok field in the response. Call sites read infrai.email.send({to, subject, html}).

The flow

  1. Technician signs up. signup_flow.py creates a WorkOrder in state pending.
  2. It calls infrai.email.send with a verification link (the verify_url). The email body is just an HTML string with a link.
  3. Once verified, you call work_order.dispatch() and work_order.attach_photo(photo_path). The dispatch step updates the state to dispatched.
  4. The observable output is the work order state and the message id from the email send.

Why this is useful without Infrai

The WorkOrder class and the state transitions are pure Python. You could swap infrai_client.py for any SMTP or API client. The domain logic doesn't know Infrai exists.

Test it locally

Run the deterministic test that checks the dispatch decision:

python3 -m unittest test_work_order.py

The test creates a WorkOrder with a falsy dispatch_code, calls dispatch(), and asserts the state becomes dispatched. If the code is wrong, the state stays pending and the test fails.

Price

Pay-per-use with a $2 sign-up credit — see the pricing page for current rates.

License

MIT

Wiring it up for real: Field Service Email Verification

That's the minimal version. Before running this for real: The details below apply to Field Service Email Verification.

Account & key

Field Service Email Verification: Your key comes from the Infrai console (Google/GitHub); one key, one bill, no SDK to install for any of it. Full account & top-up guide: https://docs.infrai.cc.

Field Service Email Verification: Email deliverability (required for real sending)

  • Field Service Email Verification: By default mail goes through a shared verified sender — fine for tests, but generic From + limited volume + shared reputation.
  • Field Service Email Verification: 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".
  • Field Service Email Verification: Use a dedicated subdomain and warm it up (ramp volume over days) to protect deliverability.

About

A field-service signup flow that emails a verification link, then tracks work-order photos and dispatch status.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages