Skip to main content

Prescription events

The prescription.* events fire whenever an electronic prescription is issued or Osigu attempts to deliver it to the patient.

Two typical use cases:

  • You need a reliable signal that a prescription has been issued so you can trigger a downstream workflow (charge the visit, notify the pharmacy).
  • You need to know if the patient email delivery succeeded or bounced so you can offer the doctor a resend.

Event types

event_typeWhen it fires
prescription.issuedA new electronic prescription was created (v1, v1.1, or v2).
prescription.email_deliveredOsigu successfully delivered the notification email to the patient.
prescription.email_failedDelivery bounced or was rejected by the destination server.

prescription.issued

Fires immediately after any createPrescription variant succeeds.

{
"event_type": "prescription.issued",
"data": {
"prescription_id": "rx_01HXF...",
"prescription_code": "RX-2026-9182",
"version": "v1", // or "v1.1" or "v2"
"patient": {
"patient_id": "pat_...",
"first_name": "Ana",
"last_name": "López"
},
"doctor": {
"doctor_id": "doc_...",
"medical_board_registration": "MP-12345"
},
"diagnoses": [{ "diagnosis_code": "R51" }],
"medications": [
{ "product_code": "MED-042", "quantity": 30, "posology": "1c/8h", "duration_days": 10 }
],
"issued_at": "2026-06-25T16:00:00Z"
}
}

What to do: persist the mapping between your local encounter and Osigu's prescription_id; trigger downstream flows if any.

prescription.email_delivered

Fires when the delivery notification was accepted by the destination SMTP.

{
"event_type": "prescription.email_delivered",
"data": {
"prescription_id": "rx_01HXF...",
"prescription_code": "RX-2026-9182",
"email": "ana@example.com",
"delivered_at": "2026-06-25T16:00:12Z"
}
}

Note this means "the receiving SMTP acknowledged the message" — not necessarily "the patient opened it". Osigu does not track open events.

prescription.email_failed

Fires when the delivery bounced or was rejected.

{
"event_type": "prescription.email_failed",
"data": {
"prescription_id": "rx_01HXF...",
"email": "ana@example.com",
"reason": "550 mailbox not found",
"attempted_at": "2026-06-25T16:00:12Z"
}
}

What to do: surface an "email delivery failed" state to the doctor; offer them a resend after they update the patient's email on file.

Not emitted (but sometimes expected)

Two events Osigu does not emit, in case you were looking for them:

  • prescription.voided — electronic prescriptions cannot be revoked once issued. If a doctor made a mistake, they issue a new prescription and the old code simply expires unused.
  • prescription.dispensed — dispensation status lives under dispensing.* events, not prescription.*. Listen for dispensing.completed with code_type: 'PRESCRIPTION'.