76 SUM(num_images) as total_images
77 FROM ${USAGE_TABLE}
78 WHERE our_api_token = 1
79 GROUP BY user_id, username
80 ORDER BY total_price DESC
258 <th>Finish</th>
259 <th>Images</th>
260 <th>Our API</th>
261 </tr>
262 </thead>
278 <td>${row.finish_reason}</td>
279 <td>${formatNumber(row.num_images)}</td>
280 <td>${formatBoolean(row.our_api_token)}</td>
281 </tr>
282 `).join("")
1import fetch from "npm:node-fetch";
2import process from "node:process";
3import { BskyAgent } from "npm:@atproto/api";
4import * as cheerio from "npm:cheerio";
5
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.
81
821. **Create a Slack App**:
83 - Go to [Slack API Apps](https://api.slack.com/apps) → Create New App → From scratch
84 - Name your app and select your workspace
85 - Click "Create App"
20createTables().catch(console.error);
21
22// API routes
23app.route("/api", postRoutes);
24
25// Serve static files
37 async function fetchPosts() {
38 try {
39 const response = await fetch('/api/posts');
40 if (!response.ok) {
41 throw new Error('Failed to fetch posts');
86
87 try {
88 const response = await fetch(`/api/posts/${slug}`);
89 if (response.status === 404) {
90 navigate('/not-found');
9 <script src="https://esm.sh/highlight.js@11.9.0" crossorigin></script>
10 <link rel="stylesheet" href="https://esm.sh/highlight.js@11.9.0/styles/github.css">
11 <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Source+Sans+Pro:wght@300;400;600&display=swap">
12 <script src="https://esm.town/v/std/catch"></script>
13 <style>
31
32/**
33 * API response for posts list
34 */
35export interface PostsResponse {
39
40/**
41 * API response for a single post
42 */
43export interface PostResponse {
46
47/**
48 * API response for tags list
49 */
50export interface TagsResponse {
8- Markdown support for blog posts
9- SQLite database for content storage
10- API endpoints for managing blog content
11- Beautiful typography and reading experience
12
413 // Update todo status
414 try {
415 const response = await fetch('/api/todos/' + todoId, {
416 method: 'PUT',
417 headers: {
671 try {
672 // Submit log data
673 const response = await fetch('/api/log', {
674 method: 'POST',
675 headers: {