blog2025-04-08-migration.md1 match
83We didn't. We left them where they are, and proxy to them.
8485Writing a proxy in Val Town (or any functions platform with the ['fetch handler' interface](https://blog.val.town/blog/the-api-we-forgot-to-name/)) is a delight:
8687```ts
bloglive-reload.ts1 match
82// if we wanted to create a /lastUpdatedAt route,
83// which would let us pass a val town bearer token, we could do that here
84// gives us 10k API requests per minute instead of 1k
85// and would work with private projects
86
blogget-old-posts.ts25 matches
19export const oldPosts: BlogPost[] = [
20{
21"title": "Solving the internal / external API riddle",
22"slug": "api-conundrum",
23"link": "/blog/api-conundrum",
24"description": "Figuring out how to provide an API that's usable by everyone and fast for us to iterate on",
25"pubDate": "Thu, 27 Mar 2025 00:00:00 GMT",
26"author": "Tom MacWright",
27},
28{
29"title": "API Tokens Scopes",
30"slug": "api-token-scopes",
31"link": "/blog/api-token-scopes",
32"description": "Improving security with granular control over permissions",
33"pubDate": "Fri, 01 Nov 2024 00:00:00 GMT",
59},
60{
61"title": "Expanding the Vals API - RFC",
62"slug": "expanding-the-vals-api-rfc",
63"link": "/blog/expanding-the-vals-api-rfc",
64"description": "Our REST API lets you do a lot - and soon it will enable more",
65"pubDate": "Fri, 30 Jun 2023 00:00:00 GMT",
66"author": "André Terron",
133},
134{
135"title": "The perks of a good OpenAPI spec",
136"slug": "openapi",
137"link": "/blog/openapi",
138"description": "Taking advantage of our typed REST API to build a platform around\nVal Town.",
139"pubDate": "Thu, 25 Jul 2024 00:00:00 GMT",
140"author": "Tom MacWright",
262},
263{
264"title": "The API we forgot to name",
265"slug": "the-api-we-forgot-to-name",
266"link": "/blog/the-api-we-forgot-to-name",
267"description": "An API that takes a Request and returns a Response - what was that, again?",
268"pubDate": "Thu, 19 Oct 2023 00:00:00 GMT",
269"author": "Steve Krouse",
286},
287{
288"title": "Deprecating the Run API",
289"slug": "deprecating-the-run-api",
290"link": "/blog/deprecating-the-run-api",
291"description": "Not every function should be an API",
292"pubDate": "Wed, 07 Feb 2024 00:00:00 GMT",
293"author": "André Terron",
321"slug": "val-town-newsletter-1",
322"link": "/blog/val-town-newsletter-1",
323"description": "Programmatic notifications, Hacker News API, and more.",
324"pubDate": "Wed, 04 Jan 2023 00:00:00 GMT",
325"author": "Steve Krouse",
450"slug": "val-town-newsletter-22",
451"link": "/blog/val-town-newsletter-22",
452"description": "Townie upgrades, Scoped API permissions, Fal partnership",
453"pubDate": "Mon, 02 Dec 2024 00:00:00 GMT",
454"author": "Steve Krouse",
blog2025-04-23-upgrading.md9 matches
8Today, we’re unifying our two primitives — *vals* and *projects* — into a single primitive: the **val**, with the best features of both.
910Historically, vals have been simple and lightweight, but limited to a single file. This upgrade will preserve the elegant spirit of our platform while supporting more complex code and collaborative workflows. This upgrade will help you create bigger things on Val Town – APIs, internal tools, fullstack apps, blogs ([like this one](https://www.val.town/x/valdottown/blog)), and much more – without sacrificing the simplicity you've always loved about vals.
1112*Legacy vals* will temporarily become *projects* during this migration. Post-migration, the concept of *projects* will disappear entirely — leaving only upgraded *vals*. In short: *legacy vals* → *projects* → *vals*.
16For most users, no upgrade action is required. We’ll auto-migrate your vals next week. All existing HTTP endpoints, crons, email handlers, and custom domains will be preserved.
1718For those with mission-critical vals or who use our API to edit or create vals, you can start upgrading your legacy vals today and integrating with our updated API.
1920- **April 23, 2025** – Announcement of changes & API deprecations.
21- **April 30, 2025** – All remaining *legacy vals* auto-upgraded. Deprecated API routes become read-only.
22- **May 1, 2025** – The term *projects* will no longer exist — everything will simply be a *val*.
2335[See more details in our docs.](https://docs.val.town/upgrading/legacy-vals)
3637## API Changes
3839Today, we're introducing the following API routes:
4041```bash
73```
7475View our [updated API reference here](https://docs.val.town/openapi).
7677All `v1/vals` API routes become read-only on **April 30, 2025**. If you rely on *writing* to those routes, please upgrade to our new `v2/vals` API. All deprecated API routes will continue serving historical legacy val data.
7879### SDK changes
85861. Upgrade your mission-critical vals early.
872. Update your Val Town API & SDK usage to `/v2` routes.
883. All remaining legacy vals migrate on **April 30, 2025**.
894. Migration completes on **May 1, 2025**.
whatsapp-callbackindex.tsx5 matches
6// Retrieve environment variables
7const WHATSAPP_WEBHOOK_VERIFY_TOKEN = Deno.env.get("WHATSAPP_WEBHOOK_VERIFY_TOKEN");
8const WHATSAPP_GRAPH_API_TOKEN = Deno.env.get("WHATSAPP_GRAPH_API_TOKEN");
910app.post("/webhook", async (c) => {
21console.log("Message from:", message.from, "Message text:", message.text.body);
2223if (WHATSAPP_GRAPH_API_TOKEN && business_phone_number_id) {
24// Send a reply message
25try {
29method: "POST",
30headers: {
31"Authorization": `Bearer ${WHATSAPP_GRAPH_API_TOKEN}`,
32"Content-Type": "application/json",
33},
49method: "POST",
50headers: {
51"Authorization": `Bearer ${WHATSAPP_GRAPH_API_TOKEN}`,
52"Content-Type": "application/json",
53},
65}
66} else {
67console.error("WHATSAPP_GRAPH_API_TOKEN or business_phone_number_id is missing.");
68}
69}
TownieuseProject.tsx2 matches
2import { useAuth } from "./useAuth.tsx";
34const PROJECT_ENDPOINT = "/api/project";
5const FILES_ENDPOINT = "/api/project-files";
67export function useProject (projectId: string, branchId?: string) {
TownieuseProjects.tsx1 match
2import { useAuth } from "./useAuth.tsx";
34const ENDPOINT = "/api/projects-loader";
56export function useProjects () {
TownieuseCreateProject.tsx1 match
3import { useAuth } from "./useAuth.tsx";
45const ENDPOINT = "/api/create-project";
67export function useCreateProject () {
TownieuseCreateBranch.tsx1 match
2import { useAuth } from "./useAuth.tsx";
34const ENDPOINT = "/api/create-branch";
56export function useCreateBranch (projectId: string) {
TownieuseChatLogic.ts4 matches
6project: any;
7branchId: string | undefined;
8anthropicApiKey: string;
9bearerToken: string;
10selectedFiles: string[];
16project,
17branchId,
18anthropicApiKey,
19bearerToken,
20selectedFiles,
37status,
38} = useChat({
39api: "/api/send-message",
40body: {
41project,
42branchId,
43anthropicApiKey,
44selectedFiles,
45images: images