Skip to content

Commit

Permalink
Trigger CI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
simonireilly committed Jun 30, 2019
1 parent b045b96 commit 6d8ac32
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ commands:

jobs:
integration:
executor: node-only
executor: kafka-node
steps:
- checkout
- prepare-node
Expand All @@ -63,7 +63,7 @@ jobs:

unit:
working_directory: ~/app
executor: kafka-node
executor: node-only
steps:
- checkout
- prepare-node
Expand Down
46 changes: 46 additions & 0 deletions test/support/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Simple Webhook Server
//
// This server is a simple express serer designed to mimic responses from webhooks

// Libraries
import express from 'express'
import { json } from 'body-parser'

// Config
const app = express().use(json()) // creates http server
const token = 'test' // type here your verification token

// Setup routes
app.get('/', (req, res) => {
// check if verification token is correct
if (req.query.token !== token) {
return res.sendStatus(401)
}

// return challenge
return res.end(req.query.challenge)
})

app.post('/', (req, res) => {
// check if verification token is correct
if (req.query.token !== token) {
return res.sendStatus(401)
}

// print request body
console.log(req.body)

// return a text response
const data = {
responses: [
{
type: 'text',
elements: ['Hi', 'Hello']
}
]
}

res.json(data)
})

app.listen(3000, () => console.log('[BotEngine] Webhook is listening'))

0 comments on commit 6d8ac32

Please sign in to comment.