You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$%7Burl%7D?q=api&page=23&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=api
Returns an array of strings in format "username" or "username/projectName"
Found 11714 results for "api"(1121ms)
6// Retrieve environment variables
7const WHATSAPP_WEBHOOK_VERIFY_TOKEN = Deno.env.get("WHATSAPP_WEBHOOK_VERIFY_TOKEN");
8const WHATSAPP_GRAPH_API_TOKEN = Deno.env.get("WHATSAPP_GRAPH_API_TOKEN");
910// In-memory store for conversation histories (keyed by user's phone number)
35console.log(`Sending to MCP for ${userIdentifier}:`, JSON.stringify(mcpPayload, null, 2));
3637const mcpApiResponse = await fetch("https://mcp.labspace.ai/chat", {
38method: "POST",
39headers: {
43});
4445if (!mcpApiResponse.ok) {
46const errorText = await mcpApiResponse.text();
47console.error(`Error from MCP for ${userIdentifier}: ${mcpApiResponse.status} ${mcpApiResponse.statusText}`, errorText);
48return { error: true, data: { text: "Sorry, I couldn't get a response from the assistant.", details: errorText, status: mcpApiResponse.status } };
49} else {
50const mcpResponseData = await mcpApiResponse.json();
51console.log(`Response from MCP for ${userIdentifier}:`, JSON.stringify(mcpResponseData, null, 2));
5284console.log(`Message from: ${userPhoneNumber}, Query: ${userQuery}`);
8586if (WHATSAPP_GRAPH_API_TOKEN && business_phone_number_id) {
87const result = await processQueryWithMCP(userQuery, userPhoneNumber);
88104method: "POST",
105headers: {
106"Authorization": `Bearer ${WHATSAPP_GRAPH_API_TOKEN}`,
107"Content-Type": "application/json",
108},
134try {
135console.log(`Attempting to mark message as read for ${userPhoneNumber} (message_id: ${message.id})`);
136console.log("using API token:", WHATSAPP_GRAPH_API_TOKEN);
137const markReadResponse = await fetch(
138`https://graph.facebook.com/v18.0/${business_phone_number_id}/messages`,
140method: "POST",
141headers: {
142"Authorization": `Bearer ${WHATSAPP_GRAPH_API_TOKEN}`,
143"Content-Type": "application/json",
144},
167} else {
168console.error(
169"WHATSAPP_GRAPH_API_TOKEN or business_phone_number_id is missing.",
170);
171}
195196if (directQuery) {
197const userIdentifier = "direct_api_user"; // Fixed identifier for direct API calls
198
199const result = await processQueryWithMCP(directQuery, userIdentifier);
1import { createRoute } from "https://esm.sh/@hono/zod-openapi@0.18.4";
2import { ErrorSchema, UpdateUserSchema, UserIdPathParamSchema, UserSchema } from "../schema.ts";
3