Stripe714 words
@ts-ignore. import { Stripe } from "npm:stripe"; const stripe = new Stripe(Deno.env.get("STRIPE_TEST_API_KEY")); export default async function (req: Request): Promise<Response> { const url = new URL(req.url); if (url.pathname === "/") {
Sections
Stripe Checkout
@ts-ignore. import { Stripe } from "npm:stripe"; const stripe = new Stripe(Deno.env.get("STRIPE_TEST_API_KEY")); export default async function (req: Request): Promise<Response> { const url = new URL(req.url); if (url.pathname === "/") {
Example Val Town Stripe Webhook
from "npm:stripe"; const stripe = new Stripe( Deno.env.get("stripe_sk_customer_readonly") as string, { apiVersion: "2020-08-27", } ); function getStripeCustomer(customerId: string) { return stripe.customers.retrieve(customerId); } export let newStripeEvent = async (req: Request) =>
Upgrade Guide: Safer Val Scopes333 words
is deprecated and we now use blob storage with our std/blob library instead. The equivalent function to std.set() is blob.setJSON(). // Using std/set. import { set } from "https://esm.town/v/std/set"; set("createdAt",
Sections
Use Blob Storage Instead (recommended)
Use Blob Storage Instead (recommended). Std/set is deprecated and we now use blob storage with our std/blob library instead. The equivalent function to std.set() is blob.setJSON(). // Using std/set. import
Permission errors334 words
to your secrets (--allow-env). Some system information (--allow-sys=osRelease,homedir,cpus,hostname) This allows you to access the following functionality: import os from "node:os"; os.cpus(); os.homedir(); Deno.osRelease(); Deno.hostname(); These values are not particularly useful,
Sections
Allowed permissions
Allowed permissions. Vals have the following permissions: Network access (--allow-net). Environment access, limited to your secrets (--allow-env). Some system information (--allow-sys=osRelease,homedir,cpus,hostname) This allows you to access the following functionality: import
Blob Storage366 words
method can throw ValTownBlobError for unexpected errors. Utilities. Our Blob SDK also includes some utility functions to make working with blobs easier. Copy. Copy import { blob } from "https://esm.town/v/std/blob";
Sections
Utilities
Utilities. Our Blob SDK also includes some utility functions to make working with blobs easier.
Express402 words
webhook handler to adhere to another service’s specifications (example val). The Val must be a function. It is passed two arguments, the Express req and res objects. You can use
Sections
Express
webhook handler to adhere to another service’s specifications (example val). The Val must be a function. It is passed two arguments, the Express req and res objects. You can use
JavaScript SDK414 words
to your package.json file. index.mjs import ValTown from "@valtown/sdk"; const valTown = new ValTown(); async function main() { const myProfile = await valTown.me.profile.retrieve(); console.log(myProfile); } main(); Finally, the API expects
Sections
Getting started in Node.js
to your package.json file. index.mjs import ValTown from "@valtown/sdk"; const valTown = new ValTown(); async function main() { const myProfile = await valTown.me.profile.retrieve(); console.log(myProfile); } main(); Finally, the API expects
AWS S3445 words
Ask questions about this page. You can upload and download from AWS S3 inside val functions. In this guide, you’ll create an AWS bucket, an IAM user, and then test
Sections
AWS S3
Ask questions about this page. You can upload and download from AWS S3 inside val functions. In this guide, you’ll create an AWS bucket, an IAM user, and then test
Upgrading Legacy Vals461 words
Here’s how you can handle folders: Do nothing: Upgrade vals individually; they remain separate but functional. Manual consolidation: Upgrade the main val first, then manually copy & paste other vals’
Sections
Legacy Val Folders
Here’s how you can handle folders: Do nothing: Upgrade vals individually; they remain separate but functional. Manual consolidation: Upgrade the main val first, then manually copy & paste other vals’
Telegram bot546 words
of this guide, which makes the HTTP calls to telegram more directly with simpler helper function. 1. Create your bot. Telegram has the best bot-making experience of any messaging platform.
Sections
Introduction
of this guide, which makes the HTTP calls to telegram more directly with simpler helper function.
Google Sheets1211 words
ACCOUNT ID HERE>"; const sheetID = "<YOUR SHEET ID HERE>"; const baseURL = `https://sheets.googleapis.com/v4/spreadsheets/${sheetID}/values`; async function fetchAccessToken() { const response = await fetch( `https://api.pipedream.com/v1/accounts/${accountID}?include_credentials=1`, { headers: { Authorization: `Bearer ${Deno.env.get("pipedream_api_key")}`,
Sections
6. Fetch a Google Sheets access token and use it in your val
ACCOUNT ID HERE>"; const sheetID = "<YOUR SHEET ID HERE>"; const baseURL = `https://sheets.googleapis.com/v4/spreadsheets/${sheetID}/values`; async function fetchAccessToken() { const response = await fetch( `https://api.pipedream.com/v1/accounts/${accountID}?include_credentials=1`, { headers: { Authorization: `Bearer ${Deno.env.get("pipedream_api_key")}`,