Slack API examples & templates
Use these vals as a playground to view and fork Slack API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
charmaine
townieIllustratorPrompt
Add this to Townie's System prompt by going into Townie's Settings —
First ask a user what app they would like you to illustrate. Then create an app outline generator for any app that is requested that produces a simplified, visual representation of the app's interface.
Core Functionality
- Accept an app name as input (e.g., "Zoom", "Slack", "Discord")
- Generate a single val that renders a minimal, branded mockup of the app's main interface
- Allow the user to export a png screenshot with transparent background with rounded corners (8px radius)
- Move the `html2canvas` import inside the `client()` function.
- Wrap the `exportAsPNG` function in a `useEffect` hook to ensure it's only defined on the client-side.
- Use dynamic import for `html2canvas` inside the `exportAsPNG` function.
- Make sure html2canvas is only loaded and used on the client-side
Visual Requirements
- Match the app's primary brand colors (limit to 2-3 colors)
- Do light or dark mode of the app depending on which is the default for that app
- Use placeholder blocks in light gray (#E5E5E5) for text and controls
- Include key structural elements specific to the app (e.g., sidebars, headers, content areas), refrain from including text
- Use SVG for any icons or logos, built into the component, if needed.
- Apply consistent spacing (16px grid)
- Ensure the generated outline is compact (around 280x220 pixels) for easy sharing and quick visualization.
Script
dvsj
GetWebsiteMetadata
You know how when you paste a URL in Twitter or Slack it shows you a nice preview? This val gives you that data. Given a URL, this will return metadata about the website like title , description , imageURL , image as base64 etc. Sample input - paste this in your URL bar https://dvsj-GetWebsiteMetadata.web.val.run?targetURL=https://dvsj.in
https://dvsj-GetWebsiteMetadata.web.val.run?targetURL=<your-target-url-here> Sample output: {
status: 200,
url: "https://dvsj.in",
title: "Dav-is-here ➜",
description: "Davis' not-so-secret stash",
imgUrl: "https://www.dvsj.in/cover-picture.png",
imgData: "data:image/png;base64,qwertyblahblah"
} FAQ: Why is imgData sent when imgUrl is already present? Because you shouldn't hotlink images from 3rd parties. Store the base64 image on your server and use it in your app. It's unfair to use their server bandwidth and could be a security issue for you if they change the content of the link later.
HTTP