Slack API examples & templates
This is public so you can see what's in it. If it had real secrets, it should be private. See https://www.val.town/v/curtcox/reply_to_slack_message
This val provides a way of readily having lots of different Slack bots that do different things and support different Slack workspaces without needing a bunch of Val Town accounts. If you only need a single bot on a single workspace, just go with the approach in the Val Town docs.
This bot is essentially the one described in the Val Town docs, but without any of the details. Those are externalized by the SlackConfig and SlackFunction interfaces. It is just glue. In order to make it work, you will need the following additional glue:
- a public HTTP val to handle requests like this one
- a private val to supply any info missing from the public one like this one
Actually, those could both be public or all in the same val, but the whole point of this scheme is to allow you to hide anything you want.
Twitter ๐ keyword Alerts
Custom notifications for when you, your company, or anything you care about is mentioned on Twitter.
1. Authentication
You'll need a Twitter Bearer Token. Follow these instructions to get one.
Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up.
2. Query
Change the query
variable for what you want to get notified for.
You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more!
3. Notification
Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever.
Daily Standup Bot
Every weekday at 9am EDT send a message to our team's #engineering Discord channel to start a thread to remind us to do our standup.
Slack version: @mikker/dailySlackRoundup
Twitter ๐ keyword Alerts
Custom notifications for when you, your company, or anything you care about is mentioned on Twitter.
1. Authentication
You'll need a Twitter Bearer Token. Follow these instructions to get one.
Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up.
2. Query
Change the query
variable for what you want to get notified for.
You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more!
3. Notification
Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever.
Daily Standup Bot
Every weekday at 9am EDT send a message to our team's #engineering Discord channel to start a thread to remind us to do our standup.
Slack version: @mikker/dailySlackRoundup
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.
Daily Standup Bot
Every weekday at 9am EDT send a message to our team's #engineering Discord channel to start a thread to remind us to do our standup.
Slack version: @mikker/dailySlackRoundup
Twitter ๐ keyword Alerts
Custom notifications for when you, your company, or anything you care about is mentioned on Twitter.
1. Authentication
You'll need a Twitter Bearer Token. Follow these instructions to get one.
Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up.
2. Query
Change the query
variable for what you want to get notified for.
You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more!
3. Notification
Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever.
Twitter ๐ keyword Alerts
Custom notifications for when you, your company, or anything you care about is mentioned on Twitter.
1. Authentication
You'll need a Twitter Bearer Token. Follow these instructions to get one.
Unfortunately it costs $100 / month to have a Basic Twitter Developer account. If you subscribe to Val Town Pro, I can let you "borrow" my token. Just comment on this val and I'll hook you up.
2. Query
Change the query
variable for what you want to get notified for.
You can use Twitter's search operators to customize your query, for some collection of keywords, filtering out others, and much more!
3. Notification
Below I'm sending these mentions to a private channel in our company Discord, but you can customize that to whatever you want, @std/email, Slack, Telegram, whatever.
Sends a daily message to the team Slack channel. Similar to 37signals' What did you work on today?