Back to APIs list![bohaska avatar](https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvb2F1dGhfZ2l0aHViL2ltZ18yYm52YmtpdmFseEZjVXRlNnI4dDRqcTlvRGMifQ)
![tmcw avatar](https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvdXBsb2FkZWQvaW1nXzJUbmdsaHJKczVGSDdSS1R5MGtjVVczVFRtTi5qcGVnIn0)
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
US Congress Stock Trading API examples & templates
Use these vals as a playground to view and fork US Congress Stock Trading API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
nationstatesSentimentAI
@bohaska
Cron
Automatically answers issues from NationStates using AI sentiment analysis, for free! Requires: Huggingface token (HF_TOKEN) for the sentiment analysis of options. Generate a read-only token at Huggingface after making an account to use. Email address (EMAIL) for user agent. Required as per NationStates ToS Autologin token (AUTOLOGIN) for logging into NationStates. See NationStates API docs for more info. Nation name (NATION_ID). Put your nation name, the one you use when you login to your account. Selects the option with the highest positivity score. Feel free to adapt the algorithm to your own tastes. See the Republic of Positivum for an example of this val in action.
trackIphoneTradein
@tmcw
Cron
Track iPhone trade-in prices iPhone trade in values - to trade phones back to Apple themselves - fluctuate over time , and eventually they no longer accept certain kinds of phones. You can still trade in an iPhone 7 - released in 2016 , about 6 years ago as of this writing. But no longer does an iPhone 6 have value back to Apple. This tracks those values - it runs every month and records prices to iphoneTradeInValues , which I'll visualize once there's some data.
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
discordWebhook
@stevekrouse
Script
Send a Discord message Send a message to a Discord channel from Val Town. It's useful for notifying your team or community when someone interesting happens, like a user signup, Stripe payment, mention on social media, etc. import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
await discordWebhook({
url: Deno.env.get("engDiscord"),
content: "Hi from val town!",
});
Example val: https://www.val.town/v/stevekrouse.discordWebhookEx Setup 1. Create a Discord Webhook Follow the instructions here: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks It really only takes 2 minutes. 2. Copy webhook URL Paste it into your secrets as discordWebhook . 3. Send a message! import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
await discordWebhook({
url: Deno.env.get("engDiscord"),
content: "Hi from val town!",
}); Example val: https://www.val.town/v/stevekrouse.discordWebhookEx