Skip to content

Instantly share code, notes, and snippets.

{
command: "/effin",
team_id: "TEAMTEAM",
channel_id: "ABCDBA",
text: "delight",
team_domain: "yourworkspace",
user_id: "123456789",
response_url: "https://hooks.slack.com/commands/TEAMTEAM/45645446/a12b23c34d45",
channel_name: "directmessage",
token: "lalalala",
{
"response_type": "in_channel",
"attachments": [
{
"title": quote.contents,
"title_link": quote.twitter_url,
"image_url": quote.url
}
]
}
class CommandsController < ApplicationController
skip_before_action :verify_authenticity_token, :only => :create
protect_from_forgery except: [:create]
def create
quote,random = EffinQuote.find_or_random(command_params[:text])
HTTParty.post(command_params[:response_url], { body: contents(quote).to_json, headers: {
"Content-Type" => "application/json"
}
class OauthController < ApplicationController
def authorize
options = {
site: 'https://slack.com/oauth/authorize'
}
client ||= OAuth2::Client.new(
ENV('SLACK_CLIENT_ID'),
ENV('SLACK_CLIENT_SECRET'),
options
)
movies = [
{
name: 'Vitalina Varela',
year: 2019,
runtime: 124,
categories: [ 'drama' ],
'release-date': '2019-08-14',
director: 'Pedro Costa',
writer: [ 'Pedro Costa', 'Vitalina Varela' ],
actors: [