81
82// ============================================================
83// TELEGRAM API INTERACTION
84// ============================================================
11 try {
12 const botToken = process.env.TELEGRAM_BOT_TOKEN;
13 const response = await fetch(`https://api.telegram.org/bot${botToken}/setWebhook`, {
14 method: "POST",
15 headers: { "Content-Type": "application/json" },
37 const botToken = process.env.TELEGRAM_BOT_TOKEN;
38
39 const response = await fetch(`https://api.telegram.org/bot${botToken}/getWebhookInfo`);
40 const result = await response.json();
41 return result;
286 "https://app.vellum.ai/_next/static/chunks/pages/_error-9bc36082609f2674.js.map",
287 "https://app.vellum.ai/_next/static/chunks/pages/accept-invite-190ccfc61094d02d.js.map",
288 "https://app.vellum.ai/_next/static/chunks/pages/api-keys-ad7c4818b157828f.js.map",
289 "https://app.vellum.ai/_next/static/chunks/pages/data-export-jobs/[dataExportJobId]-7472b2fc1a9a3f2c.js.map",
290 "https://app.vellum.ai/_next/static/chunks/pages/deployments-8934ba311790cc1f.js.map",
311 "https://app.vellum.ai/_next/static/chunks/pages/onboarding/workflows-sdk/examples-1fedd13a3310214f.js.map",
312 "https://app.vellum.ai/_next/static/chunks/pages/onboarding/workflows-sdk/install-vellum-sdk-23a63d76517c8d09.js.map",
313 "https://app.vellum.ai/_next/static/chunks/pages/onboarding/workflows-sdk/setup-provider-api-access-9cabba2913661d20.js.map",
314 "https://app.vellum.ai/_next/static/chunks/2828-3afe94e83eb754c9.js.map",
315 "https://app.vellum.ai/_next/static/chunks/pages/onboarding/workflows-sdk/setup-vellum-api-key-cdf0ac3a278a322f.js.map",
316 "https://app.vellum.ai/_next/static/chunks/pages/onboarding/workflows-sdk/test-installation-c0f7ad02f765085e.js.map",
317 "https://app.vellum.ai/_next/static/chunks/pages/organization-85e6b4c0e6a639e2.js.map",
12 },
13 {
14 "prompt": "weather dashboard for nyc using open-meteo API for NYC with icons",
15 "title": "Weather App",
16 "code":
8
91. Sign up for [Cerebras](https://cloud.cerebras.ai/)
102. Get a Cerebras API Key
113. Save it in your project env variable called `CEREBRAS_API_KEY`
211 } catch (error) {
212 Toastify({
213 text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
214 position: "center",
215 duration: 3000,
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>CerebrasCoder</title>
7 <link rel="preconnect" href="https://fonts.googleapis.com" />
8 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9 <link
10 href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
11 rel="stylesheet"
12 />
21 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
22 <meta property="og:type" content="website">
23 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
24
25
16 };
17 } else {
18 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
19 const completion = await client.chat.completions.create({
20 messages: [
2import querystring from "npm:querystring";
3
4const NOW_PLAYING_ENDPOINT = "https://api.spotify.com/v1/me/player/currently-playing";
5const TOKEN_ENDPOINT = "https://accounts.spotify.com/api/token";
6
7const client_id = Deno.env.get("spotify_client_id");
31Refer to [Twitter's search operators](https://socialdata.gitbook.io/docs/twitter-tweets/retrieve-search-results-by-keyword#endpoint-parameters) to fine-tune your query.
32
33### 4. Test API call
34Set `isProd = false` in the code if you are testing, to ensure there are enough tweets to display. <br>
35Toggle it back to `true` when you're ready to run this cron job in production and actuall send notifications.
60
61### NOTE: Usage Limits
62This val uses the SocialData API for Twitter data:
63
64- **Proxies via Val Town's [SocialDataProxy](https://www.val.town/v/stevekrouse/socialDataProxy)**: Limited to 10 cents per day for [**Val Town Pro users**](https://www.val.town/pricing). This API is *only* for Pro users.
65- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.