• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
sunnyatlightswitch

sunnyatlightswitch

send-transcripts

Public
Like
send-transcripts
Home
Code
2
README.md
H
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
6/21/2025
Viewing readonly version of main branch: v24
View latest version
README.md

Text Email API

A simple API endpoint that receives text and emails it directly to configured recipients.

Recipients

The API sends emails directly to:

  • sunny@getlightswitch.com
  • sunny.p.israni@gmail.com

Features

  • Send text content via email to multiple recipients
  • Automatic timestamping of submissions
  • HTML and plain text email formats
  • Input validation and error handling
  • Email delivery confirmation

Configuration

The email recipients are configured in the code:

const EMAIL_RECIPIENTS = [ "sunny@getlightswitch.com", "sunny.p.israni@gmail.com" ];

API Endpoints

POST /api/text

Send text content via email to account owner (with intended recipient info).

Request Body:

{ "text": "Your text content here" }

Response:

{ "success": true, "message": "Text emailed successfully to account owner (intended for 2 recipients)", "intendedRecipients": ["sunny@getlightswitch.com", "sunny.p.israni@gmail.com"], "timestamp": "2024-01-01T12:00:00.000Z", "note": "Val Town free tier limitation: Email sent to account owner. Please forward to intended recipients." }

GET /api/text

Get email service status and recipient information.

Response:

{ "message": "Email service is active", "intendedRecipients": ["sunny@getlightswitch.com", "sunny.p.israni@gmail.com"], "info": "POST to this endpoint to send text via email", "note": "Val Town free tier: Emails sent to account owner, please forward to intended recipients" }

Email Format

Each email includes:

  • Subject: "New Text Submission - [timestamp]"
  • Intended Recipients: Listed at the top of the email
  • HTML version: Formatted with styling and structure
  • Plain text version: Simple text format
  • Timestamp: When the submission was received
  • Content: The submitted text (preserves formatting)
  • Forward Instructions: Reminder to forward to intended recipients

Usage Examples

Send text using curl:

curl -X POST https://your-val-url/api/text \ -H "Content-Type: application/json" \ -d '{"text": "Hello, this is my message!"}'

Check service status:

curl https://your-val-url/api/text

Error Handling

The API returns appropriate HTTP status codes:

  • 200: Success (email sent)
  • 400: Bad request (missing or invalid text)
  • 500: Server error (email delivery failed)

All error responses include an error field with a descriptive message.

Setup Instructions

  1. Update email recipients in the code (replace the example emails)
  2. Test the API with a sample message
  3. Check recipient inboxes to confirm delivery

Email Delivery

  • Emails are sent using Val Town's built-in email service
  • Due to free tier limitations, emails go to the account owner
  • The intended recipients are clearly listed in the email content
  • You'll need to manually forward the email to the intended recipients
  • Delivery is typically instant
  • Failed deliveries will return a 500 error
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.