#!/usr/bin/env node /** * Comprehensive campaign update script * - Enables custom recipients for minister-specific campaigns * - Adds custom recipients (ministers, officials) where needed * - Rewrites email content to be representative-focused OR minister-focused as appropriate * * Run with: node scripts/update-campaigns-comprehensive.js */ const https = require('https'); // NocoDB Configuration const NOCODB_API_TOKEN = 'H3z5PEgvrC25LDRuvRpF1wuzsByG9PCem5DHyjPj'; const PROJECT_ID = 'plc0u50kgobr2xh'; const CAMPAIGNS_TABLE_ID = 'mh98emvhot9gjrg'; const CUSTOM_RECIPIENTS_TABLE_ID = 'muvkajqu4hw2wju'; // ============================================================================ // CAMPAIGNS THAT NEED CUSTOM RECIPIENTS (go to specific officials) // ============================================================================ const customRecipientCampaigns = { // Independent bodies 'ombudsman-investigation': { recipient: { name: 'Alberta Ombudsman', email: 'info@ombudsman.ab.ca', title: 'Office of the Ombudsman', organization: 'Government of Alberta' }, email_subject: 'Request for Ombudsman Investigation', email_body: `Dear Alberta Ombudsman, I am writing to request your office investigate a matter of government accountability. As an independent office that investigates complaints about unfair treatment by provincial government authorities, your role is critical to maintaining trust in Alberta's public institutions. I believe there may be unfair treatment or administrative issues that warrant your attention. Specifically, I am concerned about: - Government transparency and accountability - Fair treatment of Albertans by government agencies - Administrative processes that may be causing harm I respectfully request that your office consider investigating these concerns and taking appropriate action to ensure fairness for all Albertans. Thank you for your service in protecting Albertans from government unfairness. Sincerely, [Your Name] [Your Postal Code]` }, 'human-rights': { recipient: { name: 'Alberta Human Rights Commission', email: 'humanrights@gov.ab.ca', title: 'Commission', organization: 'Alberta Human Rights Commission' }, email_subject: 'Human Rights Protection Concerns', email_body: `Dear Alberta Human Rights Commission, I am writing regarding human rights protections in Alberta. The Commission plays a vital role in protecting Albertans from discrimination and promoting human rights. I am concerned about: - Ensuring strong enforcement of human rights protections - Addressing systemic discrimination in institutions - Supporting marginalized communities facing rights violations - Promoting human rights education across the province I urge the Commission to continue its important work and to advocate for stronger human rights protections where needed. Thank you for your dedication to protecting the rights of all Albertans. Sincerely, [Your Name] [Your Postal Code]` }, 'asirt-investigation': { recipient: { name: 'ASIRT', email: 'asirt@gov.ab.ca', title: 'Alberta Serious Incident Response Team', organization: 'Police Review Commission' }, email_subject: 'Support for Independent Police Investigations', email_body: `Dear ASIRT, I am writing regarding the importance of independent police investigations in Alberta. As the team responsible for investigating serious incidents involving police, your work is essential to maintaining public trust in law enforcement. I want to express my support for: - Thorough and independent investigations - Transparency in investigation processes - Accountability when misconduct is found - Support for families affected by serious incidents Independent oversight of police is fundamental to a just society. Thank you for your important work in ensuring police accountability. Sincerely, [Your Name] [Your Postal Code]` }, // Premier and specific ministers (from "love" campaigns) 'love-smith': { recipient: { name: 'Premier Danielle Smith', email: 'premier@gov.ab.ca', title: 'Premier of Alberta', organization: 'Government of Alberta' }, email_subject: 'Supporting Love and Community in Alberta', email_body: `Dear Premier Smith, I am writing regarding the importance of supporting all Albertans' freedom to love and build meaningful relationships and communities. As Premier, your leadership sets the tone for how our province values diversity and inclusion. Love comes in many forms, and our province is stronger when all families and relationships are valued. I urge you to: - Support LGBTQ2S+ rights and protections - Value diverse family structures - Create inclusive communities for all Albertans - Ensure equal rights for all relationships Freedom to love strengthens our communities. Please ensure Alberta remains a place where everyone can love freely and live authentically. Sincerely, [Your Name] [Your Postal Code]` }, 'love-ellis': { recipient: { name: 'Deputy Premier Mike Ellis', email: 'PSES.minister@gov.ab.ca', title: 'Deputy Premier and Minister of Public Safety and Emergency Services', organization: 'Government of Alberta' }, email_subject: 'Safety for All Albertan Families', email_body: `Dear Deputy Premier Ellis, I am writing to advocate for public safety that protects all Albertans, including diverse families and LGBTQ2S+ individuals. True public safety means everyone feels safe in their communities. This requires: - Protection against hate crimes and discrimination - Training for law enforcement on diverse communities - Safe spaces for all families - Equal protection under the law regardless of identity Please ensure your public safety approach protects all Albertans equally, including those from marginalized communities. Sincerely, [Your Name] [Your Postal Code]` }, 'love-turton': { recipient: { name: 'Minister Searle Turton', email: 'cfs.minister@gov.ab.ca', title: 'Minister of Children and Family Services', organization: 'Government of Alberta' }, email_subject: 'Support for Diverse Family Structures', email_body: `Dear Minister Turton, I am writing about the importance of supporting all family structures in Alberta's Children and Family Services. Families come in many forms, and every child deserves love and support regardless of their family structure. Your ministry should: - Support diverse family arrangements - Ensure LGBTQ2S+ families have equal access to services - Train staff on inclusive family support - Protect children in all family configurations Please ensure your ministry supports all Alberta families with equal care and respect. Sincerely, [Your Name] [Your Postal Code]` }, 'love-williams': { recipient: { name: 'Minister Rick Wilson', email: 'mha.minister@gov.ab.ca', title: 'Minister of Mental Health and Addiction', organization: 'Government of Alberta' }, email_subject: 'Inclusive Mental Health Services', email_body: `Dear Minister Wilson, I am writing about the importance of inclusive mental health services that support all Albertans. Mental health is deeply connected to our ability to live authentically and love freely. We need mental health services that: - Are affirming of LGBTQ2S+ identities - Support healthy relationship building - Address the mental health impacts of discrimination - Help all Albertans thrive regardless of their identity Please ensure mental health services in Alberta are inclusive and supportive of all identities. Sincerely, [Your Name] [Your Postal Code]` }, 'learn-glubish': { recipient: { name: 'Minister Nate Glubish', email: 'techinn.minister@gov.ab.ca', title: 'Minister of Technology and Innovation', organization: 'Government of Alberta' }, email_subject: 'Technology and Innovation in Education', email_body: `Dear Minister Glubish, I am writing regarding the role of technology and innovation in supporting education and learning opportunities for all Albertans. In today's digital age, technology should be empowering learners, not creating barriers. I believe we need: - Affordable internet access for all students and learners - Digital literacy programs across all age groups - Technology-enabled distance learning options - Innovation in educational delivery methods - Support for lifelong learning through technology Please consider how your ministry can better support technology-enabled learning for all Albertans. Sincerely, [Your Name] [Your Postal Code]` }, 'rest-nixon': { recipient: { name: 'Minister Jason Nixon', email: 'scss.minister@gov.ab.ca', title: 'Minister of Assisted Living and Social Services', organization: 'Government of Alberta' }, email_subject: 'Social Services Support for Work-Life Balance', email_body: `Dear Minister Nixon, I am writing regarding how social services can better support Albertans' need for rest, recovery, and work-life balance. Many Albertans, particularly those relying on social supports, face impossible choices between working multiple jobs and caring for their wellbeing. We need: - Social programs that don't penalize rest and recovery - Support for caregivers who need respite - Services that recognize rest as essential to health - Community spaces for relaxation and rejuvenation Please consider how your ministry can better support Albertans' fundamental need for rest and recovery. Sincerely, [Your Name] [Your Postal Code]` } }; // ============================================================================ // REPRESENTATIVE-FOCUSED CAMPAIGNS (go to user's elected representative) // ============================================================================ const representativeCampaigns = { // === FREETO === 'learning-access': { email_subject: 'Constituent Request: Access to Education', email_body: `Dear [Representative Name], I am writing as your constituent to ask you to advocate for better access to education in Alberta. Education should be a lifelong journey, not just something we do until we can get a job. Yet many Albertans face significant barriers to learning including: - Financial constraints that make post-secondary unaffordable - Limited access to programs, especially in rural areas - Lack of flexible learning options for working adults - Insufficient support for career changers and retraining I urge you to advocate in the Legislature for: - More affordable post-secondary education - Expanded adult education and retraining programs - Better support for lifelong learning - Reduced student debt burdens An educated population is an innovative population. Please make education access a priority. Sincerely, [Your Name] [Your Postal Code]` }, 'higher-learning': { email_subject: 'Constituent Request: Higher Education Accessibility', email_body: `Dear [Representative Name], I am writing as your constituent about the accessibility of higher education in Alberta. Too many Albertans are forced to choose between education and financial stability. The current system saddles graduates with decades of debt. I urge you to advocate for: - Reduced tuition fees and increased funding for institutions - Expanded scholarship and grant programs - Better support for mature students returning to school - More vocational and technical training options Investing in higher education is investing in Alberta's future. Please champion accessible post-secondary education. Sincerely, [Your Name] [Your Postal Code]` }, 'mental-health-rest': { email_subject: 'Constituent Request: Mental Health and Work-Life Balance', email_body: `Dear [Representative Name], I am writing as your constituent about the mental health challenges facing many Albertans, particularly related to burnout and work-life balance. Our worth isn't measured by our productivity alone. Alberta has developed a culture of overwork that damages mental health, families, and communities. I urge you to advocate for: - Better mental health services and support - Policies that protect work-life balance - Recognition that rest is essential, not weakness - Reduced stigma around mental health challenges Well-rested workers are healthier and more productive. Please champion mental health and work-life balance. Sincerely, [Your Name] [Your Postal Code]` }, 'work-life': { email_subject: 'Constituent Request: Work-Life Balance Policies', email_body: `Dear [Representative Name], I am writing as your constituent about the urgent need for work-life balance protections in Alberta. Our province has a culture of overwork where 60-hour weeks are normalized and burnout is treated as a badge of honor. Research shows countries with better work-life balance actually have higher productivity. I urge you to advocate for: - Enforcement of reasonable working hours - Protection of vacation time and sick leave - Support for flexible work arrangements - Policies that value workers as people Please champion policies that give Albertans the freedom to have lives outside of work. Sincerely, [Your Name] [Your Postal Code]` }, 'community-spaces': { email_subject: 'Constituent Request: Community Cultural Spaces', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for community cultural spaces where Albertans can gather and build connections. Strong communities need places to come together. I urge you to advocate for: - Accessible community centers in all neighborhoods - Funding for cultural celebrations and events - Spaces for diverse communities to gather - Support for local arts and cultural programs Please prioritize investment in community spaces that bring Albertans together. Sincerely, [Your Name] [Your Postal Code]` }, 'public-spaces': { email_subject: 'Constituent Request: Public Gathering Spaces', email_body: `Dear [Representative Name], I am writing as your constituent about the importance of public spaces where Albertans can gather and build community. In an age of increasing isolation, public gathering spaces are more important than ever. I urge you to advocate for: - Well-maintained public parks and plazas - Free community event spaces - Accessible facilities for all abilities - Year-round gathering options Please support investment in public spaces that build stronger Alberta communities. Sincerely, [Your Name] [Your Postal Code]` }, 'arts-support': { email_subject: 'Constituent Request: Arts and Culture Funding', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for stronger support for arts and culture in Alberta. A thriving creative sector makes our communities vibrant and contributes to economic diversification. Creative industries create jobs and generate economic value beyond oil and gas. I urge you to advocate for: - Increased funding for artists and arts organizations - Support for creative spaces and studios - Investment in cultural programming - Recognition that arts contribute to our economy Please increase support for arts and culture in Alberta. Sincerely, [Your Name] [Your Postal Code]` }, 'assembly-rights': { email_subject: 'Constituent Request: Freedom of Assembly', email_body: `Dear [Representative Name], I am writing as your constituent about the fundamental right to peaceful assembly in Alberta. The freedom to gather - for protests, community meetings, cultural celebrations - is essential to democracy. I urge you to advocate for: - Protection for peaceful protesters - Clear guidelines that respect assembly rights - No excessive use of force against peaceful gatherings - Support for community organizing The right to assemble is how democracy functions. Please protect this fundamental freedom. Sincerely, [Your Name] [Your Postal Code]` }, 'gathering-spaces-municipal': { email_subject: 'Constituent Request: Municipal Community Spaces', email_body: `Dear [Representative Name], I am writing as your constituent about the need for municipal community gathering spaces across Alberta. Strong communities need places to come together. Municipalities require provincial support to: - Build and maintain community centers - Provide accessible gathering spaces - Support community events and programs - Create year-round indoor and outdoor venues Please advocate for provincial investment in municipal community spaces. Sincerely, [Your Name] [Your Postal Code]` }, 'association-rights-jobs': { email_subject: 'Constituent Request: Worker Association Rights', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for the protection of worker association rights in Alberta. The freedom to associate - to form unions, professional organizations, and advocacy coalitions - is fundamental. Workers need: - Protected right to organize without retaliation - Fair collective bargaining processes - Support for worker-led organizations - Protection from union-busting activities Strong worker associations build strong communities. Please protect these fundamental rights. Sincerely, [Your Name] [Your Postal Code]` }, 'cultural-association-rights': { email_subject: 'Constituent Request: Cultural Community Rights', email_body: `Dear [Representative Name], I am writing as your constituent about the importance of supporting cultural associations and community organizations in Alberta. Our province's diversity is strengthened when cultural communities can freely associate and organize. I urge you to advocate for: - Support for cultural community organizations - Funding for cultural preservation programs - Protection for cultural practices and celebrations - Recognition of the value of cultural diversity Please support the right of cultural communities to associate and thrive. Sincerely, [Your Name] [Your Postal Code]` }, 'career-transition': { email_subject: 'Constituent Request: Career Transition Support', email_body: `Dear [Representative Name], I am writing as your constituent about the need for better career transition support in Alberta. The average person changes careers 5-7 times in their lifetime. As Alberta's economy evolves, workers need systems that support, not penalize, career changes: - Funded retraining programs - Income support during career transitions - Recognition of transferable skills - Pathways between industries Please invest in career transition support for Albertans. Sincerely, [Your Name] [Your Postal Code]` }, 'social-support': { email_subject: 'Constituent Request: Social Services for Life Transitions', email_body: `Dear [Representative Name], I am writing as your constituent about how social services can better support Albertans through major life transitions. Sometimes people need to start over - after job loss, relationship breakdown, health challenges, or other life changes. I urge you to advocate for: - Transitional support programs - Housing assistance during transitions - Mental health support for major life changes - Programs that help people rebuild Please ensure social services provide a genuine safety net for Albertans starting over. Sincerely, [Your Name] [Your Postal Code]` }, // === FREEFROM === 'privacy-rights': { email_subject: 'Constituent Request: Privacy Rights Protection', email_body: `Dear [Representative Name], I am writing as your constituent about the urgent need to protect Albertans' privacy rights in an increasingly surveilled world. Just because we have nothing to hide doesn't mean we should live in glass houses. I urge you to advocate for: - Strong data protection laws - Limits on government and corporate surveillance - The right to be forgotten - Control over our personal information - Protection from invasive technologies Privacy isn't about hiding bad things - it's about maintaining basic human dignity. Please champion privacy rights for all Albertans. Sincerely, [Your Name] [Your Postal Code]` }, 'tech-privacy': { email_subject: 'Constituent Request: Digital Privacy Protection', email_body: `Dear [Representative Name], I am writing as your constituent about the protection of privacy as technology advances in Alberta. From smart devices to facial recognition, technology increasingly invades our private lives. I urge you to advocate for: - Encryption protections - Limits on corporate data collection - Transparency about surveillance technologies - Digital privacy education - Strong penalties for privacy violations Please ensure Alberta leads on protecting digital privacy. Sincerely, [Your Name] [Your Postal Code]` }, 'immigration-rights': { email_subject: 'Constituent Request: Newcomer Rights Protection', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for the rights of newcomers and immigrants in Alberta. Our province's diversity is a strength, not a weakness. Newcomers face discrimination in employment, housing, and daily life. I urge you to advocate for: - Strong anti-discrimination protections - Support for newcomer integration - Recognition of international credentials - Cultural competency in public services - Protection from xenophobia and racism Please ensure Alberta remains welcoming to newcomers and free from discrimination. Sincerely, [Your Name] [Your Postal Code]` }, 'gender-equity': { email_subject: 'Constituent Request: Gender Equity', email_body: `Dear [Representative Name], I am writing as your constituent about the ongoing need for gender equity in Alberta. Despite progress, gender-based discrimination persists in workplaces, institutions, and daily life. I urge you to advocate for: - Equal pay enforcement - Protection against gender-based discrimination - Support for women in leadership - Trans rights protections - Programs addressing gender-based violence Please continue working toward true gender equity for all Albertans. Sincerely, [Your Name] [Your Postal Code]` }, 'indigenous-relations': { email_subject: 'Constituent Request: Indigenous Rights and Reconciliation', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for advancing Indigenous relations in Alberta. True reconciliation requires more than words - it requires action. I urge you to advocate for: - Honoring treaty obligations - Respecting Indigenous sovereignty - Supporting Land Back initiatives - Addressing systemic discrimination - Meaningful nation-to-nation relationships Reconciliation without action is just empty words. Please take meaningful action on Indigenous relations. Sincerely, [Your Name] [Your Postal Code]` }, 'land-use': { email_subject: 'Constituent Request: Indigenous Rights in Land Use', email_body: `Dear [Representative Name], I am writing as your constituent about the importance of respecting Indigenous rights in land use decisions. Treaties are agreements between nations - not surrender documents. Land use decisions must: - Respect treaty territories - Include meaningful Indigenous consultation - Recognize Indigenous land rights - Protect sacred sites - Support Indigenous-led development Please advocate for respecting Indigenous rights in all land use decisions. Sincerely, [Your Name] [Your Postal Code]` }, 'police-accountability': { email_subject: 'Constituent Request: Police Accountability', email_body: `Dear [Representative Name], I am writing as your constituent about the urgent need for police accountability in Alberta. Public safety means building communities where everyone feels safe. I urge you to advocate for: - Independent civilian oversight of police - Consequences for misconduct - Mental health first responders for crisis calls - De-escalation training and requirements - Community-led safety initiatives Please take action on police accountability to build trust in our communities. Sincerely, [Your Name] [Your Postal Code]` }, 'anti-corruption': { email_subject: 'Constituent Request: Anti-Corruption Measures', email_body: `Dear [Representative Name], I am writing as your constituent about the urgent need for stronger anti-corruption measures in Alberta. When money talks louder than voters, democracy suffers. I urge you to advocate for: - Strong conflict of interest laws - Real whistleblower protection - Transparency in political donations - Limits on corporate lobbying - Independent oversight of government Please champion anti-corruption measures that protect our democracy. Sincerely, [Your Name] [Your Postal Code]` }, 'legal-accountability': { email_subject: 'Constituent Request: Justice System Accountability', email_body: `Dear [Representative Name], I am writing as your constituent about the need for greater accountability in Alberta's justice system. Justice should be blind to wealth and status. I urge you to advocate for: - Equal access to legal representation - Accountability for prosecutorial misconduct - Transparent court processes - Alternatives to incarceration - Restorative justice options Please work to ensure Alberta's justice system serves everyone fairly. Sincerely, [Your Name] [Your Postal Code]` }, 'government-reform': { email_subject: 'Constituent Request: Government Reform', email_body: `Dear [Representative Name], I am writing as your constituent about the balance between necessary government services and individual freedom. Good government protects rights rather than restricting them. I urge you to advocate for: - Privacy protections from government surveillance - Simplified regulations and reduced red tape - Transparent and accountable government agencies - Protection of digital rights - Respect for personal autonomy The goal isn't no government - it's good government that knows its limits. Please champion sensible government reform. Sincerely, [Your Name] [Your Postal Code]` }, 'justice-reform': { email_subject: 'Constituent Request: Justice System Reform', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for meaningful justice system reform in Alberta. Our justice system should protect everyone's rights equally. I urge you to advocate for: - Reduced reliance on incarceration - Investment in prevention and support - Restorative justice programs - Fair treatment regardless of wealth - Protection of civil liberties Please work toward a justice system that serves all Albertans fairly. Sincerely, [Your Name] [Your Postal Code]` }, 'economic-reform': { email_subject: 'Constituent Request: Economic Reform', email_body: `Dear [Representative Name], I am writing as your constituent about the need for economic reforms that serve working Albertans. Our economy should work for everyone, not just shareholders. I urge you to advocate for: - Living wages that keep pace with costs - Worker protections and rights - Support for small businesses - Corporate accountability - Economic diversification Please champion economic reform that works for all Albertans. Sincerely, [Your Name] [Your Postal Code]` }, 'corporate-oversight': { email_subject: 'Constituent Request: Corporate Accountability', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for stronger corporate oversight in Alberta. Corporations have responsibilities to workers, communities, and the environment. I urge you to advocate for: - Real consequences for corporate wrongdoing - Whistleblower protections - Environmental accountability - Consumer protections - Worker safety enforcement Please strengthen corporate oversight to protect Albertans. Sincerely, [Your Name] [Your Postal Code]` }, // === FREENEEDS === 'education-reform': { email_subject: 'Constituent Request: Education Investment', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for investment in Alberta's education system. Knowledge shouldn't come with crippling debt. I urge you to advocate for: - Reduced tuition and student debt - Fully funded K-12 education - Support for teachers and educational staff - Updated curricula for the modern economy - Education focused on learning, not just job training When education is accessible, innovation increases and communities thrive. Please invest in education. Sincerely, [Your Name] [Your Postal Code]` }, 'higher-education': { email_subject: 'Constituent Request: Higher Education Accessibility', email_body: `Dear [Representative Name], I am writing as your constituent about the accessibility of higher education in Alberta. The current system forces students to choose between education and financial stability. I urge you to advocate for: - Reduced tuition and fees - Expanded grants and scholarships - Support for students from all backgrounds - Vocational training options - Lifelong learning opportunities Countries with accessible higher education have higher standards and more innovation. Please make higher education accessible. Sincerely, [Your Name] [Your Postal Code]` }, 'health-reform': { email_subject: 'Constituent Request: Healthcare Reform', email_body: `Dear [Representative Name], I am writing as your constituent about the need for healthcare reform in Alberta. Healthcare is a right, not a privilege. I urge you to advocate for: - Timely access to care without excessive waits - Mental health parity with physical health - Dental and vision coverage - Affordable prescription medications - Focus on preventive care True healthcare freedom means never choosing between paying rent and getting care. Please champion comprehensive healthcare. Sincerely, [Your Name] [Your Postal Code]` }, 'mental-health': { email_subject: 'Constituent Request: Mental Health Services', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for expanded mental health services in Alberta. Our brains are part of our bodies, yet mental health services remain underfunded and inaccessible. I urge you to advocate for: - Reduced wait times for mental health care - Affordable counseling and therapy - Crisis services that respond appropriately - Support for addiction treatment - Reduced stigma around mental health Please prioritize mental health as an essential component of healthcare. Sincerely, [Your Name] [Your Postal Code]` }, 'seniors-housing': { email_subject: 'Constituent Request: Seniors Housing', email_body: `Dear [Representative Name], I am writing as your constituent about the housing crisis facing Alberta's seniors. After lifetimes of contribution, our seniors deserve secure, dignified housing. I urge you to advocate for: - More affordable seniors housing units - Support for seniors aging in place - Protection from predatory rent increases - Quality care in assisted living facilities - No senior left homeless Please prioritize housing security for Alberta's seniors. Sincerely, [Your Name] [Your Postal Code]` }, 'family-housing': { email_subject: 'Constituent Request: Family Housing', email_body: `Dear [Representative Name], I am writing as your constituent about the housing affordability crisis facing Alberta families. No child should grow up without stable housing. I urge you to advocate for: - More affordable family housing units - Rent support for struggling families - Protection from renovictions - Safe, quality housing standards - Pathways to home ownership Please take action to ensure all Alberta families have access to affordable housing. Sincerely, [Your Name] [Your Postal Code]` }, 'food-security': { email_subject: 'Constituent Request: Food Security', email_body: `Dear [Representative Name], I am writing as your constituent about food security in Alberta - a province with abundant agricultural resources. In a land of plenty, too many Albertans face food insecurity. I urge you to advocate for: - Support for local food production - Affordable access to nutritious food - Community food programs - Food desert solutions - Living wages so people can afford groceries Alberta produces enough food to feed the world. Please ensure Albertans don't go hungry. Sincerely, [Your Name] [Your Postal Code]` }, 'food-access': { email_subject: 'Constituent Request: Food Access', email_body: `Dear [Representative Name], I am writing as your constituent about food access for vulnerable Albertans. Too many Albertans rely on food banks and go without nutritious meals. I urge you to advocate for: - Expanded food assistance programs - Community food initiatives - Support for food-insecure families - Accessible food in all communities - Solutions that address root causes No Albertan should have to choose between paying bills and eating well. Please improve food access. Sincerely, [Your Name] [Your Postal Code]` }, 'water-protection': { email_subject: 'Constituent Request: Water Protection', email_body: `Dear [Representative Name], I am writing as your constituent about the protection of Alberta's precious water resources. Clean water is essential for life, yet our water sources face threats from pollution and overuse. I urge you to advocate for: - Strong protections for watersheds - Corporate accountability for water use - Updated water infrastructure - Clean drinking water for all communities - Climate adaptation for water security Water is life. Please prioritize protecting Alberta's water resources. Sincerely, [Your Name] [Your Postal Code]` }, 'water-access': { email_subject: 'Constituent Request: Clean Water Access', email_body: `Dear [Representative Name], I am writing as your constituent about access to clean drinking water in Alberta. In 2026, boil water advisories still affect Alberta communities, especially Indigenous communities. I urge you to advocate for: - Universal access to clean tap water - Infrastructure investment in underserved communities - End to boil water advisories - Fair water pricing - Public water systems, not privatization Please ensure every Albertan has access to safe, clean drinking water. Sincerely, [Your Name] [Your Postal Code]` }, 'air-quality-protection': { email_subject: 'Constituent Request: Air Quality Protection', email_body: `Dear [Representative Name], I am writing as your constituent about air quality protection in Alberta. Checking the air quality index before letting kids play outside has become too common. I urge you to advocate for: - Stronger emission controls on industry - Real-time air quality monitoring - Accountability for polluters - Wildfire prevention and response - Transition to cleaner energy Our right to breathe clean air is more important than corporate profit margins. Please strengthen air quality protections. Sincerely, [Your Name] [Your Postal Code]` }, 'air-quality-health': { email_subject: 'Constituent Request: Air Quality Health Impacts', email_body: `Dear [Representative Name], I am writing as your constituent about the health impacts of air pollution in Alberta. Orange skies and smoke-filled days are becoming too common. The health costs include increased respiratory illness, higher asthma rates, and chronic health conditions. I urge you to advocate for: - Air quality as a public health priority - Support for those affected by poor air quality - Prevention measures for wildfires - Industrial emission accountability - Healthcare resources for respiratory issues Please address air quality as a public health priority. Sincerely, [Your Name] [Your Postal Code]` }, 'environment-protection': { email_subject: 'Constituent Request: Environmental Protection', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for stronger environmental protection in Alberta. A healthy environment is essential for healthy communities. I urge you to advocate for: - Strong environmental regulations with enforcement - Protected wilderness areas - Corporate accountability for environmental damage - Transition to renewable energy - Environmental assessments with teeth A healthy environment is good for business and for Albertans. Please strengthen environmental protections. Sincerely, [Your Name] [Your Postal Code]` }, 'clean-energy': { email_subject: 'Constituent Request: Clean Energy Transition', email_body: `Dear [Representative Name], I am writing as your constituent about Alberta's transition to clean energy. Our province has abundant renewable resources - sun, wind, and geothermal. Clean energy means: - New jobs in growing industries - Reduced environmental damage - Energy independence - Lower long-term costs - Leadership in emerging markets Alberta can be an energy leader in the clean economy. Please support the clean energy transition. Sincerely, [Your Name] [Your Postal Code]` }, 'transport-reform': { email_subject: 'Constituent Request: Transportation Reform', email_body: `Dear [Representative Name], I am writing as your constituent about the need for transportation reform in Alberta. Our right to move around shouldn't require a $70,000 pickup truck. I urge you to advocate for: - Expanded public transit options - Inter-city rail connections - Protected bike infrastructure - Walkable community design - Affordable transportation alternatives True transportation freedom means options beyond expensive car ownership. Please champion transportation reform. Sincerely, [Your Name] [Your Postal Code]` }, 'municipal-transit': { email_subject: 'Constituent Request: Municipal Transit Support', email_body: `Dear [Representative Name], I am writing as your constituent about provincial support for municipal transit systems. Strong local transit benefits everyone, including those who drive. Municipalities need provincial support for: - Frequent, reliable bus service - Light rail and rapid transit expansion - Transit-oriented development - Accessibility improvements - Year-round service Please support investment in municipal transit across Alberta. Sincerely, [Your Name] [Your Postal Code]` }, // === FREETHINGS === 'energy-reform': { email_subject: 'Constituent Request: Energy Policy Reform', email_body: `Dear [Representative Name], I am writing as your constituent about energy policy in Alberta. We're sitting on an ocean of resources, yet paying some of Canada's highest utility bills. I urge you to advocate for: - Fair utility pricing - Investment in renewables - End to energy poverty - Proper use of resource revenues for Albertans - Affordable heating and electricity If we can subsidize oil companies, we can ensure Albertans can afford to heat their homes. Please reform energy policy. Sincerely, [Your Name] [Your Postal Code]` }, 'utilities-reform': { email_subject: 'Constituent Request: Utility Affordability', email_body: `Dear [Representative Name], I am writing as your constituent about utility affordability in Alberta. Seniors are choosing between heat and food. Families are struggling with utility bills. I urge you to advocate for: - Price stability and predictability - Support for those in energy poverty - Accountability for utility companies - Fair billing practices - Affordable rates for essential services Please take action to make utilities affordable for all Albertans. Sincerely, [Your Name] [Your Postal Code]` }, 'tech-innovation': { email_subject: 'Constituent Request: Technology for All Albertans', email_body: `Dear [Representative Name], I am writing as your constituent about technology and innovation policy in Alberta. The internet is essential infrastructure, not a luxury. I urge you to advocate for: - Affordable broadband for all - Rural connectivity solutions - Digital literacy programs - Support for tech innovation - Consumer protection from tech monopolies Please ensure technology policy serves all Albertans, not just corporate profits. Sincerely, [Your Name] [Your Postal Code]` }, 'telecom-reform': { email_subject: 'Constituent Request: Telecommunications Reform', email_body: `Dear [Representative Name], I am writing as your constituent about telecommunications policy affecting Albertans. Our "competitive" telecom market features a few companies charging high prices. I urge you to advocate for: - Real competition in telecommunications - Affordable phone and internet plans - Rural coverage requirements - Consumer protection enforcement - End to misleading "unlimited" plans Please advocate for telecom reform that benefits consumers. Sincerely, [Your Name] [Your Postal Code]` }, 'public-services-reform': { email_subject: 'Constituent Request: Public Services Accessibility', email_body: `Dear [Representative Name], I am writing as your constituent about fees and accessibility for public services in Alberta. We already fund these services with our taxes. Additional fees are double-charging. I urge you to advocate for: - Reduced or eliminated administrative fees - Streamlined service delivery - Expanded digital access - Accessibility for all abilities - Public services that serve the public Please make public services truly accessible to all Albertans. Sincerely, [Your Name] [Your Postal Code]` }, 'public-services-vision': { email_subject: 'Constituent Request: Public Services Vision', email_body: `Dear [Representative Name], I am writing as your constituent about the future of public services in Alberta. Public services should make life easier for Albertans, not harder. I urge you to advocate for a vision that includes: - Accessible services for all Albertans - Reduced bureaucratic barriers - Digital-first where appropriate - Maintained in-person options - Services designed for citizens, not bureaucracy Please champion a vision for public services that truly serves Albertans. Sincerely, [Your Name] [Your Postal Code]` }, 'recreation-tourism': { email_subject: 'Constituent Request: Recreation Access', email_body: `Dear [Representative Name], I am writing as your constituent about recreational access in Alberta. In a province blessed with mountains, lakes, and parks, we've somehow paywalled access to nature. I urge you to advocate for: - Affordable access to provincial parks - Free community recreation facilities - Investment in public recreation infrastructure - Support for community sports programs - Nature access for all income levels Please support accessible recreation for all Albertans. Sincerely, [Your Name] [Your Postal Code]` }, 'recreation-parks': { email_subject: 'Constituent Request: Parks Access', email_body: `Dear [Representative Name], I am writing as your constituent about public access to Alberta's parks and natural areas. Nature belongs to everyone, not just those who can afford access fees. I urge you to advocate for: - Maintained trails and facilities - Affordable camping options - Protected wilderness areas - Public facilities in parks - No privatization of public lands Please protect public access to Alberta's beautiful natural areas. Sincerely, [Your Name] [Your Postal Code]` }, // === LANDBACK === 'landback': { email_subject: 'Constituent Request: Land Back and Indigenous Rights', email_body: `Dear [Representative Name], I am writing as your constituent, and as a settler on Treaty territory, to advocate for the Land Back movement. We cannot claim to love Alberta while disrespecting its original caretakers. True reconciliation requires: - Return of stolen lands - Respect for treaty rights - Indigenous sovereignty - Economic justice for Indigenous peoples - Environmental co-stewardship Land Back isn't radical - colonization was radical. Please support meaningful action toward Land Back in the Legislature. Sincerely, [Your Name] [Your Postal Code]` }, 'land-rights': { email_subject: 'Constituent Request: Indigenous Land Rights', email_body: `Dear [Representative Name], I am writing as your constituent to advocate for respect of Indigenous land rights in Alberta. Treaties are agreements between nations - not surrender documents. Indigenous land rights include: - Recognition of traditional territories - Meaningful consultation on development - Protection of sacred sites - Resource revenue sharing - Self-determination over ancestral lands Please advocate for respecting Indigenous land rights in all government decisions. Sincerely, [Your Name] [Your Postal Code]` }, 'protected-areas': { email_subject: 'Constituent Request: Protected Natural Areas', email_body: `Dear [Representative Name], I am writing as your constituent about the protection of Alberta's natural areas. Our parks and wild spaces are invaluable - for wildlife, for recreation, for our future. I urge you to advocate for: - Expanded protected areas - No privatization of public lands - Proper funding for park management - Protection from industrial development - Indigenous co-management of protected areas Please prioritize protecting Alberta's natural heritage. Sincerely, [Your Name] [Your Postal Code]` } }; // ============================================================================ // HELPER FUNCTIONS // ============================================================================ function makeRequest(options, postData = null) { return new Promise((resolve, reject) => { const req = https.request(options, (res) => { let data = ''; res.on('data', chunk => data += chunk); res.on('end', () => { if (res.statusCode >= 200 && res.statusCode < 300) { try { resolve(JSON.parse(data)); } catch { resolve(data); } } else { reject(new Error(`HTTP ${res.statusCode}: ${data}`)); } }); }); req.on('error', reject); if (postData) req.write(postData); req.end(); }); } async function getCampaignBySlug(slug) { const options = { hostname: 'db.freealberta.org', port: 443, path: `/api/v1/db/data/v1/${PROJECT_ID}/${CAMPAIGNS_TABLE_ID}?where=(Campaign%20Slug,eq,${slug})`, method: 'GET', headers: { 'xc-token': NOCODB_API_TOKEN } }; const result = await makeRequest(options); return result.list && result.list.length > 0 ? result.list[0] : null; } async function updateCampaign(id, data) { const postData = JSON.stringify(data); const options = { hostname: 'db.freealberta.org', port: 443, path: `/api/v1/db/data/v1/${PROJECT_ID}/${CAMPAIGNS_TABLE_ID}/${id}`, method: 'PATCH', headers: { 'Content-Type': 'application/json', 'xc-token': NOCODB_API_TOKEN, 'Content-Length': Buffer.byteLength(postData) } }; return makeRequest(options, postData); } async function createCustomRecipient(data) { const postData = JSON.stringify(data); const options = { hostname: 'db.freealberta.org', port: 443, path: `/api/v1/db/data/v1/${PROJECT_ID}/${CUSTOM_RECIPIENTS_TABLE_ID}`, method: 'POST', headers: { 'Content-Type': 'application/json', 'xc-token': NOCODB_API_TOKEN, 'Content-Length': Buffer.byteLength(postData) } }; return makeRequest(options, postData); } async function getCustomRecipientsBySlug(slug) { const options = { hostname: 'db.freealberta.org', port: 443, path: `/api/v1/db/data/v1/${PROJECT_ID}/${CUSTOM_RECIPIENTS_TABLE_ID}?where=(Campaign%20Slug,eq,${slug})`, method: 'GET', headers: { 'xc-token': NOCODB_API_TOKEN } }; const result = await makeRequest(options); return result.list || []; } // ============================================================================ // MAIN EXECUTION // ============================================================================ async function main() { console.log('='.repeat(70)); console.log('COMPREHENSIVE CAMPAIGN UPDATE'); console.log('='.repeat(70)); let successCount = 0; let failCount = 0; // STEP 1: Update Custom Recipient Campaigns console.log('\n--- STEP 1: Custom Recipient Campaigns ---\n'); for (const [slug, config] of Object.entries(customRecipientCampaigns)) { try { const campaign = await getCampaignBySlug(slug); if (!campaign) { console.log(`⚠ Campaign not found: ${slug}`); failCount++; continue; } const campaignId = campaign.Id || campaign.ID || campaign.id; // Enable custom recipients and update email content await updateCampaign(campaignId, { 'Allow Custom Recipients': true, 'Email Subject': config.email_subject, 'Email Body': config.email_body }); // Check if custom recipient already exists const existingRecipients = await getCustomRecipientsBySlug(slug); const recipientExists = existingRecipients.some( r => r['Recipient Email'] === config.recipient.email ); if (!recipientExists) { // Add custom recipient await createCustomRecipient({ 'Campaign ID': campaignId, 'Campaign Slug': slug, 'Recipient Name': config.recipient.name, 'Recipient Email': config.recipient.email, 'Recipient Title': config.recipient.title, 'Recipient Organization': config.recipient.organization, 'Is Active': true }); console.log(`✓ ${slug}: Added custom recipient (${config.recipient.name})`); } else { console.log(`✓ ${slug}: Custom recipient already exists`); } successCount++; await new Promise(r => setTimeout(r, 100)); } catch (error) { console.log(`✗ ${slug}: ${error.message}`); failCount++; } } // STEP 2: Update Representative-Focused Campaigns console.log('\n--- STEP 2: Representative-Focused Campaigns ---\n'); for (const [slug, config] of Object.entries(representativeCampaigns)) { try { const campaign = await getCampaignBySlug(slug); if (!campaign) { console.log(`⚠ Campaign not found: ${slug}`); failCount++; continue; } const campaignId = campaign.Id || campaign.ID || campaign.id; // Update email content (keep custom recipients disabled) await updateCampaign(campaignId, { 'Allow Custom Recipients': false, 'Email Subject': config.email_subject, 'Email Body': config.email_body }); console.log(`✓ ${slug}: Updated for representative targeting`); successCount++; await new Promise(r => setTimeout(r, 100)); } catch (error) { console.log(`✗ ${slug}: ${error.message}`); failCount++; } } console.log('\n' + '='.repeat(70)); console.log(`COMPLETE: ${successCount} succeeded, ${failCount} failed`); console.log('='.repeat(70)); } main().catch(console.error);