Most Popular
Courier is a notification service that centralizes all of your templates and messaging channels in one place which increases visibility and reduces engineering time.
Sign-up
For our September 16th Courier Live, Paul Chin, Jr joined me to talk about Begin. Begin helps you effortlessly ship web apps and APIs on AWS. Paul recently updated his 5 year old LAMP stack Ghostbusters site into a functional FASTstack application using Begin. While updating the contact form, he decided he'd rather it send a Slack message instead of sending an email. He decided to use Courier to handle this. Together we walked through creating a new Begin application that included an HTML contact form and configured it to send using Courier.
Check out the video below to watch us:
Check out the full project code available on GitHub.
Be sure to Like the video and Subscribe to our YouTube channel.
It's easy to set up a contact form using Begin. Begin will store your static assets in an S3 bucket and help you create the serverless function needed to handle the form submit. It's easy to get started by signing in to Begin and clicking Create new app and selecting a minimal app.
You can add a form like the following to your app.
1<form id="main-contact-form" method="post" action="contact-form">2<div><input type="text" name="name" placeholder="Name" required /></div>3<div><input type="email" name="email" placeholder="Email" required /></div>4<div><input type="text" name="subject" placeholder="Subject" required /></div>5<div>6<textarea7name="message"8class="form-control"9rows="8"10placeholder="What seems to be the problem?"11required >12</textarea>13</div>14<div>15<input type="checkbox" name="urgent" value="true" />16<label for="urgent" >Urgent</label>17</div>18<div><button type="submit">Send Message</button></div>19</form>
And then create a serverless function using Begin with the same name as the form action.
1let tiny = require('tiny-json-http')2let arc = require('@architect/functions')34let sendCourier = async function (req) {5let body = req.body67let url = 'https://api.courier.com/send'89let headers = {10"authorization": `Bearer ${process.env.COURIER_AUTH_TOKEN}`,11"content-type": "application/json",12}1314let data = {15event: `praisecage-contact`,16recipient: 'pchinjr',17profile: {18slack: {19access_token: `${process.env.SLACK_TOKEN}`,20email: 'paul@praisecage.org'21}22},23data: {24name: `${body.name}`,25email: `${body.email}`,26subject: `${body.subject}`,27message: `${body.message}`,28urgent: `${body.urgent}`29}30}3132let response = await tiny.post({ url, data, headers })3334console.log(response)35}3637let route = async function (req) {38return {39statusCode: 303,40location: '/'41}42}4344exports.handler = arc.http.async(sendCourier, route)
This function will handle the form submit and send it to Courier. From there, you can use the Courier application to create your notification.
You can sign up for a free account on both Courier and Begin. I hope this stream has given you a taste of what is possible when you build your app with Begin and Courier. It's never been easier to build on top of AWS, so get started and be sure to share with us what you create.
Is there something you’d like to see us do using Courier? Let us know and it might be the subject of our next Courier Live. We stream a new Courier Live every Wednesday at noon Pacific. Follow us on Twitch to be notified when we go live.
-Aydrian
Courier is a notification service that centralizes all of your templates and messaging channels in one place which increases visibility and reduces engineering time.
Sign-up
Tools and Techniques to Establish Your Data Team Early
How tools like Segment, Metabase, Snowflake, Census, and others, can help establish a data team from the very early stages in a startup.
Raymond See
February 16, 2023
Develop a Motivational QOTD with Courier and GPT2
Courier and OpenGPT2 in action: build a service that sends friends and family an AI generated motivational quote of the day.
Prakhar Srivastav
February 09, 2023
Free Tools
Comparison Guides
Send up to 10,000 notifications every month, for free.
Get started for free
Send up to 10,000 notifications every month, for free.
Get started for free
© 2024 Courier. All rights reserved.