Skip to content

Instantly share code, notes, and snippets.

View seratch's full-sized avatar

Kazuhiro Sera seratch

View GitHub Profile
@seratch
seratch / Gemfile
Last active April 2, 2024 13:22
twitter oauth example
source 'https://rubygems.org/'
gem 'sinatra'
gem 'omniauth-twitter'
gem 'json'
gem 'twitter'
gem 'dotenv'
gem 'thin'
@seratch
seratch / README.md
Last active March 31, 2024 13:43
Sign in with Slack - the simplest example

You can run this app by following the steps below:

Set up your Slack app

  • Create a new Slack app from https://api.slack.com/apps?new_app=1
  • Go to OAuth & Permissions
    • Add identity.basic & identity.email to User Token Scopes
    • Add OAuth Redirect URL
  • Go to Basic Information
  • Grab the Client ID & Client Secret in the page
@seratch
seratch / app-manifest.yml
Created November 14, 2023 07:06
file input block in bolt-python apps
display_information:
name: file-uploader
features:
bot_user:
display_name: file-uploader
slash_commands:
- command: /send-files
description: Send files on a modal
should_escape: false
oauth_config:
@seratch
seratch / go.mod
Last active August 14, 2023 16:16
Slack Socket Mode in Go
module socket-mode-app
go 1.15
require github.com/slack-go/slack v0.8.0
@seratch
seratch / SlackApp.gs
Created February 18, 2021 15:51
Slack App in Google Apps Script
// *** Request Verification ***
// The currently recommended way is to verify request signature: https://api.slack.com/authentication/verifying-requests-from-slack
// Unfortunately, GAS web apps don"t have means to access request headers. Thus, this example uses the old way to verify requests.
// >>> Settings > Basic Information > App Credentials > Verification Token
const legacyVerificationToken = PropertiesService.getScriptProperties().getProperty("SLACK_VERIFICATION_TOKEN");
// *** OAuth Access Token ***
// Install your Slack app into its development workspace.
// >>> Settings > Install App > Bot User OAuth Access Token
const token = PropertiesService.getScriptProperties().getProperty("SLACK_BOT_TOKEN");
@seratch
seratch / build.sbt
Created March 8, 2012 03:06
Using Anorm 2.0 without Play Framework
scalaVersion := "2.9.1"
resolvers += "typesafe" at "http://repo.typesafe.com/typesafe/releases"
libraryDependencies ++= Seq(
"play" %% "anorm" % "2.0-RC4",
"com.github.seratch" %% "scalikejdbc" % "[0.5,)",
"org.hsqldb" % "hsqldb" % "[2,)"
)
@seratch
seratch / HomeController.scala
Last active March 26, 2023 14:17
Slack app built with Play Framework (Scala)
package controllers
import javax.inject._
import play.api.mvc._
@Singleton
class HomeController @Inject()(val controllerComponents: ControllerComponents) extends BaseController {
def index() = Action { implicit request: Request[AnyContent] =>
Ok("Hello World!")
@seratch
seratch / Application.java
Created September 8, 2020 14:56
Bolt for Java + Spring Boot
package hello;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
@SpringBootApplication
@ServletComponentScan
public class Application {
public static void main(String[] args) {
@seratch
seratch / Application.kt
Last active January 28, 2023 00:40
Building Slack apps with Ktor framework
package com.example
import com.slack.api.bolt.App
import com.slack.api.bolt.AppConfig
import com.slack.api.bolt.request.Request
import com.slack.api.bolt.request.RequestHeaders
import com.slack.api.bolt.response.Response
import com.slack.api.bolt.util.QueryStringParser
import com.slack.api.bolt.util.SlackRequestParser
import com.slack.api.model.block.Blocks.asBlocks
@seratch
seratch / Dockerfile
Last active November 29, 2022 22:20
Slack OAuth App Example (Google Cloud Run + Datastore)
# https://hub.docker.com/_/python
FROM python:3.9.2-slim-buster
# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True
# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./