1# KINOPIO: GET User Spaces
2
3Using the [Kinopio API docs](https://help.kinopio.club/api) lets get a list of our spaces using the authenticated `GET /user/spaces` route
4
5(This will not include group spaces created by other members of groups that you're in.)
27export const telegramWebhookChatbot = async (req: Request) => {
28 if (
29 req.headers.get("x-telegram-bot-api-secret-token") !==
30 Deno.env.get("telegramWebhookSecret")
31 ) {
6* Fork this val to your own profile.
7* Make a folder for the temporary vals that get generated, take the ID from the URL, and put it in `tempValsParentFolderId`.
8* If you want to use OpenAI models you need to set the `OPENAI_API_KEY` [env var](https://www.val.town/settings/environment-variables).
9* If you want to use Anthropic models you need to set the `ANTHROPIC_API_KEY` [env var](https://www.val.town/settings/environment-variables).
10* Create a [Val Town API token](https://www.val.town/settings/api), open the browser preview of this val, and use the API token as the password to log in.
11
12<img width=500 src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/7077d1b5-1fa7-4a9b-4b93-f8d01d3e4f00/public"/>
3export const telegramGetMe = async (botToken: string) =>
4 fetchJSON(
5 `https://api.telegram.org/bot${botToken}/getMe`,
6 );
3export const telegramGetMe = async (botToken: string) =>
4 fetchJSON(
5 `https://api.telegram.org/bot${botToken}/getMe`,
6 );
76 .toString("base64");
77
78 const response = await fetch(`https://api.switch-bot.com/${path}`, {
79 headers: {
80 "Authorization": token,
14
15Works even if the val is private if you provide
16a Val Town API token for the account that
17owns the private val in question.
18
19Below the Val Town SDK is implicitly authenticated,
20because it pulls user's Val Town API token from their
21default `'valtown'` environment variable.
22
11## What's the difference with `extractValInfo` ?
12
13@pomdtr/extractValInfo get metadata synchronously by analysing the val import url, while @pomdtr/fetchValInfo perform an http call to the val.town REST api.
14
15Only use `fetchValInfo` if you need some metadata that are not available from `extractValInfo`.
14
15Works even if the val is private if you provide
16a Val Town API token for the account that
17owns the private val in question.
18
19Below the Val Town SDK is implicitly authenticated,
20because it pulls user's Val Town API token from their
21default `'valtown'` environment variable.
22
1# OpenAI - [Docs ↗](https://docs.val.town/std/openai)
2
3Use OpenAI's chat completion API with [`std/openai`](https://www.val.town/v/std/openai). This integration enables access to OpenAI's language models without needing to acquire API keys.
4
5For free Val Town users, [all calls are sent to `gpt-4o-mini`](https://www.val.town/v/std/openaiproxy?v=12#L85).
65If these limits are too low, let us know! You can also get around the limitation by using your own keys:
66
671. Create your own API key on [OpenAI's website](https://platform.openai.com/api-keys)
682. Create an [environment variable](https://www.val.town/settings/environment-variables?adding=true) named `OPENAI_API_KEY`
693. Use the `OpenAI` client from `npm:openai`:
70