This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let begin = require('@architect/functions') | |
function index(req, res) { | |
let html = `<script type=module src=/js/entry.mjs></script>` | |
res({html}) | |
} | |
exports.handler = begin.html.get(route) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app | |
test-app | |
@scheduled | |
test-fn rate(5 minutes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is an .arc file! | |
@app | |
hellobot | |
@html | |
get / # displays Add to Slack | |
get /install # saves a bot token and redirects back to / | |
get /signin # saves a user token and redirects back to / | |
@slack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = function actions(event, context, callback) { | |
console.log(JSON.stringify(event, null, 2)) | |
callback(null, {text:'hi from button press'}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = function slash(event, context, callback) { | |
callback(null, { | |
text: 'Hello!', | |
attachments: [{ | |
text: 'Click the button', | |
fallback: 'Click the button', | |
callback_id: 'clicky', | |
color: '#eheheh', | |
actions: [{ | |
name: 'hello', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = require('../data') | |
var waterfall = require('run-waterfall') | |
var slack = require('slack') | |
module.exports = function install(req, res, next) { | |
let location = req._url('/') | |
if (req.query.code) { | |
waterfall([ | |
function read(callback) { | |
slack.oauth.access({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path') | |
var arc = require('@architect/data') | |
var arcPath = path.join(__dirname, '..', '.arc') | |
module.exports = arc(arcPath) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app | |
hellobot | |
@events | |
long-running-thing | |
@html | |
get / # displays Add to Slack | |
get /install # saves a bot token and redirects back to / | |
get /signin # saves a user token and redirects back to / |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function addToSlack() { | |
let scope = 'commands,bot' | |
let clientID = process.env.SLACK_CLIENT_ID | |
let redirect = process.env.SLACK_INSTALL_REDIRECT | |
let href = `https://slack.com/oauth/authorize?scope=${scope}&client_id=${clientID}&redirect_uri=${redirect}` | |
return ` | |
<a href=${href}> | |
<img alt="Add to Slack" | |
height="40" | |
width="139" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arc = require('@architect/functions') | |
const layout = require('@architect/shared/views/bootstrap') | |
function route(req, res) { | |
let html = layout({ | |
_url: req._url, | |
title: 'My App', | |
body: ` | |
<div class=jumbotron> | |
<h1 class=display-4>Add to Slack</h1> |