73
74 const lsdResponse = await fetch(
75 `https://lsd.so/api?query=${encodeURIComponent(query)}`,
76 );
77
7## Getting Started
8To run Slack Scout, you’ll need a
9- Browserbase API key
10- Slack Webhook URL: setup [here](https://docs.val.town/integrations/slack/send-messages-to-slack/)
11- Twitter Developer API key
12
13### Browserbase
19### Twitter
20
21We’ve decided to use the Twitter API to include Twitter post results. It costs $100 / month to have a Basic Twitter Developer account. _If you decide to use Browserbase, we can lend our token. Comment below for access._
22
23Once you have the `SLACK_WEBHOOK_URL`, `BROWSERBASE_API_KEY`, and `TWITTER_BEARER_TOKEN`, input all of these as [Val Town Environment Variables](https://www.val.town/settings/environment-variables).
24
25---
54 query: topic,
55 pages: 2,
56 apiKey: Deno.env.get("BROWSERBASE_API_KEY") ?? "",
57 });
58}
63 maxResults: 10,
64 daysBack: 1,
65 apiKey: Deno.env.get("TWITTER_BEARER_TOKEN") ?? "",
66 });
67}
98
99 if (!response.ok) {
100 throw new Error(`Slack API error: ${response.status} ${response.statusText}`);
101 }
102
4 const headers = new Headers(req.headers);
5 headers.set("x-proxy-authorization", `Bearer ${Deno.env.get("valtown")}`);
6 return fetch("https://fal-faltownproxy.web.val.run/api/faltown/proxy", {
7 method,
8 headers,
5console.info("Launching browser...");
6
7// Use Deno.env to get the API key
8const apiKey = Deno.env.get("BROWSERBASE_API_KEY");
9if (!apiKey) {
10 console.error("BROWSERBASE_API_KEY environment variable is not set");
11 Deno.exit(1);
12}
14try {
15 const browser = await chromium.connectOverCDP(
16 `wss://connect.browserbase.com?apiKey=${apiKey}`,
17 );
18 console.info("Connected!");
51 // /.proxy/ is prepended here in compliance with CSP
52 // see https://discord.com/developers/docs/activities/development-guides#construct-a-full-url
53 const response = await fetch("/.proxy/api/token", {
54 method: "POST",
55 headers: {
104
105/**
106 * This function utilizes RPC and HTTP apis, in order show the current guild's avatar
107 * Here are the steps:
108 * 1. From RPC fetch the currently selected voice channel, which contains the voice channel's guild id
109 * 2. From the HTTP API fetch a list of all of the user's guilds
110 * 3. Find the current guild's info, including its "icon"
111 * 4. Append to the UI an img tag with the related information
117 }
118
119 // 1. From the HTTP API fetch a list of all of the user's guilds
120 const guilds = await fetch(
121 "https://discord.com/api/users/@me/guilds",
122 {
123 headers: {
108
109/**
110 * Converts parameters to the proper representation to send to the ArcGIS REST API.
111 * @param params The object whose keys will be encoded.
112 * @return A new object with properly encoded values.
1Copy of [ArcGISIdentityManager.authorize()](https://github.com/Esri/arcgis-rest-js/blob/bfd7ce977d9879077e92fabfc491240d8f230844/packages/arcgis-rest-request/src/ArcGISIdentityManager.ts#L760), OAuth2 authentication for the ESRI ArcGIS API which is implemented as Express middleware, ported to Hono.
2
3Migrated from folder: gisc/arcGISHonoMiddleware
47 <pre><code id="resultCode"></code></pre>
48 </div>
49 <h2>API Documentation</h2>
50 <p>To use the POST endpoint programmatically, send a POST request to this URL with the TypeScript code in the request body.</p>
51 <h3>Curl Example:</h3>
15 try {
16 const fal = createFalClient({
17 proxyUrl: "/api/fal/proxy",
18 });
19
139 }
140
141 if (url.pathname === "/api/fal/proxy") {
142 return falProxyRequest(req);
143 }