From d52301b19ec65029df36b873c63ca09d4f3570b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ra=C4=8D=C3=A1k?= Date: Thu, 14 Nov 2024 11:29:33 +0100 Subject: [PATCH] Update donation thank you email * Update copy * Add HTML version --- functions/donation/thank-you.ts | 81 +++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 14 deletions(-) diff --git a/functions/donation/thank-you.ts b/functions/donation/thank-you.ts index c994b4a610b..ebf612845ad 100644 --- a/functions/donation/thank-you.ts +++ b/functions/donation/thank-you.ts @@ -32,27 +32,79 @@ const hasThankYouEnvVars = (env: unknown): env is ThankYouEnvVars => { } const constructMessage = (data: MessageData): string => { + // This is more readable and makes the plain text formatting easier than a + // template string. return [ - `Dear ${data.name ? data.name : "Sir/Madam"},`, - "Thank you for your donation to support Global Change Data Lab – the non-profit organization that helps produce the website Our World in Data.", + "Thank you for supporting Our World in Data!", + "Your generous donation to Global Change Data Lab, the nonprofit behind Our World in Data, helps us achieve our mission to make data and research on the world’s biggest challenges easier to understand and use, for everyone: https://ourworldindata.org/problems-and-progress Together, we can make progress against those challenges.", + "Donations like yours are essential to our work. They provide us with the stability and independence to expand our work and increase our impact — delivering more data, charts, and insights on an increasing number of pressing topics, all free and open to the world.", data.isMonthly && - "You will receive monthly receipts of your payment. If you wish to cancel your recurring donation at any point, just email us at donate@ourworldindata.org.", - data.giftAid && - `If you are a UK tax payer, we can make your donations go further with Gift Aid. Through the Government’s Gift Aid scheme, we can claim an additional 25p for every £1 you donated. So if you are a UK taxpayer, you can increase the value of your donations to us by 25%, at no extra cost to yourself. Simply fill in your details in this form to confirm your taxpayer status: https://docs.google.com/forms/d/e/1FAIpQLSe7Mgm70-3UiRfh_aEJCusWCabdBFPN7hXoXMnby_6aAJsJVg/viewform?usp=pp_url&entry.2044643286=gcdl_${data.customerId}`, - "Your generosity offers vital support in expanding our efforts to build an independent and free online publication on global development. Your donation will support the expansion of the online publication in close collaboration with our research colleagues at the University of Oxford and around the world.", - "Given your interest in our work, we hope you will continue to follow our progress via our newsletters – if you have not done so, we’d like to invite you to join: https://ourworldindata.org/subscribe.", - `Reader donations are essential to our work, providing us with the stability and independence we need, so we can focus on research and the development of our site. ${ - data.showOnList - ? "In recognition of your support we will be delighted to include your name as part of our List of Supporters: https://ourworldindata.org/supporters. We will add your name the next time we update the list and the sum of your donation will not be disclosed." - : "" - }`, - "Thank you again for your support for Our World in Data, we look forward to taking the project to the next level and we hope that you will remain interested in our work.", - "Kind regards,\nThe Our World in Data Team", + "We really appreciate your ongoing support! You’ll receive a receipt each month after your payment is processed. If you’d like to cancel your recurring donation at any point, just email us at donate@ourworldindata.org and we’ll take care of that for you.", + data.showOnList && + "In recognition of your support, we will be delighted to include your name as part of our List of Supporters: https://ourworldindata.org/funding. We will add your name the next time we update the list, which we do every few months. The amount of your donation will not be disclosed.", + "Stay connected with our work: Follow us on social media or sign up for one of our newsletters here: https://ourworldindata.org/#subscribe (As a valued donor, we may also share an occasional donor-only update with you, from which you may unsubscribe at any time.)", + `Are you a UK taxpayer? If so, you can increase the value of your donation to us by 25% — at no extra cost to you — through the UK government’s Gift Aid scheme. Simply enter your name and address and tick a box on this form to confirm your UK taxpayer status, and we’ll take care of the rest:\n\n https://docs.google.com/forms/d/e/1FAIpQLSe7Mgm70-3UiRfh_aEJCusWCabdBFPN7hXoXMnby_6aAJsJVg/viewform?usp=pp_url&entry.2044643286=gcdl_${data.customerId}.\n\nLet us know if you have any questions: donate@ourworldindata.org`, + "Thank you again for supporting us! Your generosity makes our work possible.", + "Wishing you the best,\nThe Our World in Data Team", ] .filter(Boolean) .join("\n\n") } +function constructHtmlMessage(data: MessageData): string { + // The HTML comment is to make prettier format the string as HTML. + return /* HTML */ `

Thank you for supporting Our World in Data!

+

+ Your generous donation to Global Change Data Lab, the nonprofit + behind Our World in Data, helps us achieve + our mission + to make data and research on the world’s biggest challenges easier + to understand and use, for everyone. Together, we can make + progress against those challenges. +

+

+ Donations like yours are essential to our work. They provide us with + the stability and independence to expand our work and increase our + impact — delivering more data, charts, and insights on an increasing + number of pressing topics, all free and open to the world. +

+ ${data.isMonthly + ? `

We really appreciate your ongoing support! You’ll receive a receipt each month after your payment is processed. If you’d like to cancel your recurring donation at any point, just email us at donate@ourworldindata.org and we'll take care of that for you.

` + : ""} + ${data.showOnList + ? `

In recognition of your support, we will be delighted to include your name as part of our List of Supporters. We will add your name the next time we update the list, which we do every few months. The amount of your donation will not be disclosed.

` + : ""} +

+ Stay connected with our work: Follow us on social + media or sign up for one of our newsletters here: + https://ourworldindata.org/#subscribe + (As a valued donor, we may also share an occasional donor-only + update with you, from which you may unsubscribe at any time.) +

+

+ Are you a UK taxpayer? If so, you can increase the + value of your donation to us by 25% — at no extra cost to you — + through the UK government’s Gift Aid scheme. Simply + enter your name and address and tick a box on + this form + to confirm your UK taxpayer status, and we’ll take care of the rest. + Let us know if you + have any questions. +

+

+ Thank you again for supporting us! Your generosity makes our work + possible. +

+

Wishing you the best,
The Our World in Data Team

` +} + async function sendThankYouEmail( data: MessageData, env: ThankYouEnvVars @@ -64,6 +116,7 @@ async function sendThankYouEmail( bcc: "donate@ourworldindata.org", subject: "Thank you", text: constructMessage(data), + html: constructHtmlMessage(data), }, env )