Add Slack oauth trigger
This commit is contained in:
parent
815d1a4dcd
commit
95e7eff734
2 changed files with 5 additions and 0 deletions
1
app.js
1
app.js
|
@ -59,6 +59,7 @@ app.use(route.post('/search', search));
|
||||||
app.use(route.get('/:service/:type/:id.:format?', share));
|
app.use(route.get('/:service/:type/:id.:format?', share));
|
||||||
|
|
||||||
app.use(route.post('/slack', slack));
|
app.use(route.post('/slack', slack));
|
||||||
|
app.use(route.get('/slack', slack));
|
||||||
|
|
||||||
if (!module.parent) {
|
if (!module.parent) {
|
||||||
app.listen(process.env.PORT || 3000, () => {
|
app.listen(process.env.PORT || 3000, () => {
|
||||||
|
|
|
@ -16,6 +16,10 @@ const queue = kue.createQueue({
|
||||||
const slackToken = process.env.SLACK_TOKEN;
|
const slackToken = process.env.SLACK_TOKEN;
|
||||||
|
|
||||||
export default async function (ctx) {
|
export default async function (ctx) {
|
||||||
|
if (ctx.request.method === 'GET') {
|
||||||
|
ctx.redirect('https://slack.com/oauth/authorize?client_id=349358389361.349904899522&team=TA9AJBFAM&install_redirect=general&scope=links:read,chat:write:bot');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (ctx.request.body.challenge) {
|
if (ctx.request.body.challenge) {
|
||||||
ctx.body = ctx.request.body.challenge;
|
ctx.body = ctx.request.body.challenge;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue