Email to Are.na Attachment Processor

This project automatically processes email attachments and saves them as blocks to an Are.na channel.

How it works

  1. Email Trigger (email-to-arena.ts): Receives emails and processes attachments
  2. Blob Server (blob-server.ts): Serves stored attachments as public URLs
  3. Are.na Integration: Creates blocks in your specified channel with attachment URLs

Setup

1. Environment Variables

You need to set these environment variables in your Val Town settings:

  • ARENA_API_KEY: Your Are.na API key (get from https://dev.are.na/oauth/applications)
  • ARENA_CHANNEL_SLUG: The slug of the Are.na channel where blocks should be added
  • VAL_TOWN_USERNAME: Your Val Town username (used for generating URLs)

2. Are.na API Key

  1. Go to https://dev.are.na/oauth/applications
  2. Create a new application
  3. Copy the access token and set it as ARENA_API_KEY

3. Channel Setup

  1. Create or choose an Are.na channel
  2. Get the channel slug from the URL (e.g., for https://are.na/username/my-channel, the slug is my-channel)
  3. Set this as ARENA_CHANNEL_SLUG

Usage

  1. Send an email with attachments to your Val Town email address
  2. The system will:
    • Store each attachment in blob storage
    • Create a public URL for each attachment
    • Add a block to your Are.na channel with the attachment URL and metadata

Features

  • Supports any file type as attachment
  • Preserves original filename and content type
  • Adds metadata including sender, subject, file size
  • Handles multiple attachments per email
  • Error handling for individual attachments

File Structure

  • email-to-arena.ts - Main email processing logic
  • blob-server.ts - HTTP endpoint to serve stored attachments
  • README.md - This documentation

Troubleshooting

  • Check the Val Town logs for error messages
  • Ensure your Are.na API key has write access to the channel
  • Verify the channel slug is correct (case-sensitive)
  • Large attachments may take longer to process