Back to APIs list

Twitter API examples & templates

Use these vals as a playground to view and fork Twitter API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
willthereader avatar
willthereader
homepage
HTTP
@jsxImportSource https://esm.sh/hono@latest/jsx
0
tylergaw avatar
tylergaw
socialImageUsage
HTTP
Usage example of https://www.val.town/v/tylergaw.socialImage
0
websrai avatar
websrai
seoKeywordResearchTool
HTTP
@jsxImportSource https://esm.sh/react@18.2.0
0
stevekrouse avatar
stevekrouse
shySapphireLeopard
HTTP
Forked from muhammad_owais_warsi/shySapphireLeopard
1
websrai avatar
websrai
aigeneratorblog
HTTP
@jsxImportSource https://esm.sh/react@18.2.0
0
stevekrouse avatar
stevekrouse
azureBeetle
HTTP
Forked from willthereader/homepage
0
stevekrouse avatar
stevekrouse
favFarm
HTTP
Forked from stevekrouse/valwriter_output
2
pomdtr avatar
pomdtr
blog
HTTP
Val Town Blog A blog written, developed and hosted on val.town. How ? Each article on this blog is contained single val, with a #blog tag. See this example article . // #blog // title: Example Post import { article } from "https://esm.town/v/pomdtr/article"; import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo"; import { html } from "https://esm.town/v/stevekrouse/html?v=5"; export async function examplePost(req: Request) { const { author, name } = extractValInfo(import.meta.url); return html(await article(author, name)); } Each of these post work on it's own . This val is able to: list them with the /v1/search api (with a #blog query) post with different author than the owner of this val will be filtered out only public vals will be listed render the readme of those vals using remark (with github styling) This process run each time a user visit the web endpoint , so the blog is always up to date. You can get your own instance of the blog by just forking this val .
3
purplesquirrelmedia avatar
purplesquirrelmedia
linkInBio
HTTP
Forked from stevekrouse/linkInBioTemplate
0
gigmx avatar
gigmx
linkInBioTemplate
HTTP
Forked from stevekrouse/linkInBioTemplate
0
jaandrle avatar
jaandrle
mastodon$instances_cz
Script
An interactive, runnable TypeScript val by jaandrle
0
yawnxyz avatar
yawnxyz
counter
HTTP
// Export app.fetch for Val Town, otherwise export app — this is only for hono apps
0
nknj avatar
nknj
salmonMole
HTTP
Find comments on HN (powered by Algolia ), extract content and return a streaming markdown summary (powered by Substrate ). The RAG portion of this is 34 lines of Substrate code. Read the walkthrough: https://x.com/vprtwn/status/1812844236401762513 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits. See also: https://www.val.town/v/substrate/twitterRAG
0
iamseeley avatar
iamseeley
personalData
Script
An interactive, runnable TypeScript val by iamseeley
0
stevedylandev avatar
stevedylandev
twemoji
Script
* modified version of https://unpkg.com/twemoji@13.1.0/dist/twemoji.esm.js.
0
dvsj avatar
dvsj
subscribeToNewsletter
HTTP
Add an email entry option to your static website/blog. Easy peasy. 🚀 PoV: You just hacked together a portfolio website or launched a blog as a static website. Some people who visit might be interested in hearing more from you. ❤️ But you don't want to get lost building your backend, API, DB or fancy apps like SubstandardStack or MailMachineGun for people to sign up to your newsletter. 😩 All you want is a simple input box on your website - when someone types their email , username or social link in and submits it, you want to be notified. psst...do you want another one that uses the DB instead of email so you can look up all entries at once? Let me know and I'll get cooking! Quickstart Call the val URL with data in the query param userContact . That's it! // Format `https://<val_url>?userContact=<mandatory_primary_contact>` // Examples `https://dvsj-subscribeToNewsletter.web.val.run?userContact=dav.is@zohomail.in` `https://dvsj-subscribeToNewsletter.web.val.run?userContact=CatalanCabbage` Bonus Have extra data apart from email? Pass any encoded data in the queryParam userData , will be included in the email. It's optional. // Format `https://<val_url>?userContact=<mandatory_primary_contact>&userData=<optional_any_data>` //Examples `https://dvsj-subscribeToNewsletter.web.val.run?userContact=dav.is@zohomail.in&userData={"time": "2/2/1969", "twitter": "https://twitter.com/dvsj_in"}` // Note: All values should be URL encoded. Example: let userData = {"time": "2/2/1969", "twitter": "https://twitter.com/dvsj_in"} let encodedUserData = encodeURIComponent(userData) //This should go in the query param Want bot protection? Add a simple question to your website, like "okay, so what's one minus one?" . In the val, set isBotProtectionOn = true and botProtectionAnswer="0" . When you call the val, include the encoded user's answer to the bot question as botProtection query param. Answer will be compared with botProtectionAnswer ; if the answer is wrong, the request is rejected. // Format `https://<val_url>?userContact=<mandatory_primary_contact>&userData=<optional_any_data>&botProtection=<answer>` //Examples `https://dvsj-subscribeToNewsletter.web.val.run?userContact=dav.is@zohomail.in&botProtection=123` Add it to your website Want to add it to your site but get a headstart coding it? Use this ChatGPT prompt to get code for your website! I'm building a simple form submission component. It should a submit button and these 2 input boxes: 1. "userContact" to get the user's email (mandatory) 2. "userData" to get a custom message from the user (optional) On clicking the submit button: 1. Both input values should be encoded using "encodeURIComponent" 2. A GET URL should be built in this format with query params. Include userData query param only if input is not null or empty. `https://dvsj-subscribeToNewsletter.web.val.run?userContact=<encodedUserContact>&userData=<encodedUserData>` 3. The GET URL should be called and result printed in the console. I'm using React, so make it a react component.
0