// Care for Kansas – Embeddable Advocacy Insert
// Files included below. Save each section into the named file path in your project.
/*
README (README.md)
*/
# Care for Kansas – Advocacy Insert
This repository contains a complete embeddable advocacy widget (React frontend + Node/Express backend) that lets users (patients, physicians, Kansans) look up their representatives and send a pre-filled email advocating to expand access to naturopathic medicine in Kansas.
## What is included
– `frontend/src/components/CareForKansas.jsx` – React component (Tailwind classes) ready to embed
– `backend/index.js` – Node/Express server for representative lookup and email sending
– `.env.example` – expected environment variables
– `package.json` snippets and setup instructions
—
/*
File: frontend/src/components/CareForKansas.jsx
*/
import React, { useState } from ‘react’;
export default function CareForKansas() {
const [form, setForm] = useState({ name: ”, email: ”, street: ”, city: ”, zip: ”, role: ‘Patient’ });
const [preview, setPreview] = useState(”);
const [recipients, setRecipients] = useState([]);
const [status, setStatus] = useState(”);
const roleTemplates = {
Patient: {
subject: ‘Expand Access to Naturopathic Medicine in Kansas’,
body: `Dear [Recipient],\n\nAs a patient living in Kansas, I am writing to urge you to support policies that expand access to naturopathic medicine.\n\nFor many Kansans like me, finding affordable, timely, and preventive care is increasingly difficult—especially in underserved and rural areas. Naturopathic physicians provide safe and effective care that focuses on prevention and whole-person health, complementing the existing healthcare system.\n\nExpanding access to naturopathic medicine would allow more patients to receive the care they need when they need it. This is not about replacing current providers, but about adding valuable healthcare resources to better serve our communities.\n\nI respectfully ask you to support legislation that recognizes and expands naturopathic medicine in Kansas. Patients deserve more access, more options, and more support for their health.\n\nSincerely,\n[Name]\n[City], Kansas`
},
Physician: {
subject: ‘Strengthen Kansas Healthcare by Expanding Naturopathic Medicine’,
body: `Dear [Recipient],\n\nAs a physician in Kansas, I see every day how limited access to care impacts patients and communities—especially in rural and underserved areas.\n\nNaturopathic physicians are trained in safe, evidence-based, preventive, and primary care practices. By expanding access to naturopathic medicine, Kansas would strengthen its healthcare workforce, reduce pressure on overburdened hospitals and clinics, and provide patients with more comprehensive care options.\n\nThis is not about replacing existing providers. It is about collaboration and creating a stronger, more sustainable care system for our state.\n\nI urge you and your colleagues on the [House Committee on Health and Human Services / Senate Committee on Public Health and Welfare] to advance legislation recognizing naturopathic physicians as part of the solution to Kansas’s healthcare access crisis.\n\nThank you for considering this important step toward better health outcomes for all Kansans.\n\nSincerely,\n[Name], [Credentials]\n[City], Kansas`
},
Supporter: {
subject: ‘Support Greater Access to Naturopathic Medicine in Kansas’,
body: `Dear [Recipient],\n\nAs a resident of Kansas, I care deeply about the health of our state and the well-being of my community.\n\nMany Kansans live in areas where healthcare is limited or difficult to access. Expanding access to naturopathic medicine would help fill critical gaps by providing safe, preventive, and effective care that complements the work of other healthcare providers.\n\nThis expansion is not about replacing anyone—it is about giving Kansans more options and ensuring that families, seniors, and individuals in underserved areas have the support they need to live healthier lives.\n\nI respectfully ask you to support legislation that expands recognition and access to naturopathic physicians. Our state deserves a stronger, more inclusive healthcare system.\n\nThank you for your time and service.\n\nSincerely,\n[Name]\n[City], Kansas`
}
};
function buildPreview(template) {
const name = form.name || ‘[Name]’;
const city = form.city || ‘[City]’;
// assemble body and subject, and replace placeholders
const raw = template.body.replace(‘[Name]’, name).replace(‘[City]’, city);
return raw;
}
async function findReps() {
setStatus(‘Looking up representatives…’);
try {
const address = `${form.street}, ${form.city}, ${form.zip}`;
const res = await fetch(‘/api/lookup’, {
method: ‘POST’, headers: { ‘Content-Type’: ‘application/json’ }, body: JSON.stringify({ address })
});
const data = await res.json();
if (data.ok) {
setRecipients(data.recipients || []);
setStatus(`Found ${data.recipients.length} recipients`);
// build preview addressing first recipient generically
const template = roleTemplates[form.role === ‘Kansan Supporter’ ? ‘Supporter’ : form.role];
setPreview(buildPreview(template));
} else {
setStatus(‘Could not find representatives: ‘ + (data.error || ‘unknown’));
}
} catch (err) {
setStatus(‘Lookup failed: ‘ + err.message);
}
}
async function sendEmails() {
if (!form.name || !form.email) { setStatus(‘Please enter your name and email.’); return; }
if (!recipients.length) { setStatus(‘No recipients found. Click “Find My Representatives” first.’); return; }
setStatus(‘Sending emails…’);
const templateKey = form.role === ‘Kansan Supporter’ ? ‘Supporter’ : form.role;
const template = roleTemplates[templateKey];
const payload = {
name: form.name, email: form.email, city: form.city, subject: template.subject, body: template.body,
recipients
};
try {
const res = await fetch(‘/api/send’, { method: ‘POST’, headers: { ‘Content-Type’: ‘application/json’ }, body: JSON.stringify(payload) });
const data = await res.json();
if (data.ok) { setStatus(‘Email(s) sent. Thank you for taking action.’); }
else setStatus(‘Send failed: ‘ + (data.error || ‘unknown’));
} catch (err) { setStatus(‘Send failed: ‘ + err.message); }
}
return (
Care for Kansas: Expand Access to Naturopathic Medicine
Send a pre-written, editable message to your local leaders and health committee members.
setForm({ …form, name: e.target.value })} />
setForm({ …form, email: e.target.value })} />
setForm({ …form, street: e.target.value })} />
setForm({ …form, city: e.target.value })} />
setForm({ …form, zip: e.target.value })} />
Your message will be sent to your Governor, State Representatives, State Senators, Mayor (if found), and members of the House & Senate health committees.
Status: {status}