@@ -0,0 +1,78 @@
1++++
2+title = "Send Emails to a Mailing List"
3+date = "2021-10-07"
4+[taxonomies]
5+grant_type = ["Proposal"]
6+grant_category = ["App Dev: Other"]
7+[extra]
8+image = ""
9+description = "An agent that works with SendGrid, to be used for sending subscriber content to a mailing list."
10+reward = 4
11+assignee = "~novlud-padtyv"
12+grant_id = "P0082"
13+completed = false
14+canceled = false
15+link = ""
16+
17++++
18+
19+## Send Emails to a Mailing List via Urbit
20+
21+Writers prefer reaching their audiences via email because email has the highest open rate. Urbit provides a writer the ability to own their data and network, but limits a publication's reach by confining it within Urbit. Enabling a writer to send emails from their Publish Notebook directly to their mailing list will allow them to reach their whole audience while continuing to own all of their data, and enhance Urbit’s popularity as a content platform.
22+
23+We propose writing a Gall agent called `%mailer` to hook up a writer’s Urbit server to the Sendgrid REST API and allow them to automatically send emails to different mailing lists when they publish new notes to specified notebooks.
24+
25+The initial task is getting the Urbit to send plaintext emails and basic HTML emails properly. Next, we
26+allow the Urbit to store the writer's mailing list in a Gall agent and provide a means of importing mailing addresses via CSV.
27+
28+Once `%graph-store` posts can be converted to HTML, we will support converting `%graph-store` posts to rich HTML emails. The mark converters will work in the same way as in the static site project but repurposed for the context of email.
29+
30+The interface to this project will be provided as a “Mailer” tile which has basic UI affordances for setting a Sendgrid API key, importing a CSV mailing list, and choosing to associate or dissociate any given Publish notebook with a mailing list.
31+
32+### Architecture
33+
34+One gall agent: %mailer
35+
36+++on-init
37+
38+On initial load, tells file-server that it wants to serve a webpage at /mailer
39+
40+++on-poke
41+
42+Receives commands that allow the following:
43+
44+- setting a new named mailing list
45+- adding email addresses to an existing mailing list
46+- removing email addresses from an existing mailing list
47+- removing a mailing list
48+- setting a SendGrid API key, and other account details, which then makes the necessary calls to sendgrid to configure the account properly
49+- sending an email to a mailing list
50+- beginning to listen to a particular publish notebook (which will then send an email for every new note added)
51+- stopping listening to a particular publish notebook.
52+- handle callback from SendGrid for mailing list unsubscribe events
53+
54+++on-peek
55+
56+- Read out a particular mailing list
57+- read out the keys of all existing mailing lists (and their associated publish notebooks)
58+- read out the SendGrid account details
59+
60+## Milestones
61+
62+### Milestone 1 - Basic %mailer app and templates
63+
64+Expected completion:
65+
66+Payment: 1 star
67+
68+- App should be fully functional according to the architecture description above, but does not have a friendly frontend
69+
70+- A number of mark converters that implement email templates for notebook posts.
71+
72+### Milestone 2 - Delivery of the frontend
73+
74+Estimated completion:
75+
76+Payment: 3 stars
77+
78+- Gated on Grid shipping, the app should have a grid tile that gives the user an interface for setting up the SendGrid api details, managing mailing lists and their associated notebooks.