Readme
Code
HTTP
import { httpClient } from "https://esm.town/v/pomdtr/http_client";
export default httpClient(handler);
async function handler(request: Request) {
try {
if (request.method !== "POST") {
return Response.json({ message: "This val responds to POST requests." }, {
status: 400,
});
}
const CONFIG = {
CUSTOM_SECRET: process.env.NOTION_WALLABAG_SECRET,
WALLABAG_URL: process.env.WALLABAG_URL,
WALLABAG_CLIENT_ID: process.env.WALLABAG_CLIENT_ID,
WALLABAG_CLIENT_SECRET: process.env.WALLABAG_CLIENT_SECRET,
WALLABAG_USERNAME: process.env.WALLABAG_USERNAME,
WALLABAG_PASSWORD: process.env.WALLABAG_PASSWORD,
};
const authHeader = request.headers.get("custom-auth");
if (!authHeader || authHeader !== CONFIG.CUSTOM_SECRET) {
return new Response("Unauthorized", { status: 401 });
}
const body = await request.json();
console.log("Received webhook payload:", JSON.stringify(body, null, 2));
const properties = body?.data?.properties;
if (!properties) {
return Response.json({ message: "No properties found in webhook payload" }, {
status: 400,
});
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
v52 was merged from the PR "Added postman-like interface" by stevekrouse
Comments
Nobody has commented on this val yet: be the first!
michaelfromyeg-notion2wallabag.web.val.run
Updated: January 1, 2025