Skip to content

Commit

Permalink
update express.js example
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasassisrosa committed Sep 9, 2019
1 parent 0fabf82 commit 89c485d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.node*.js
node_modules
8 changes: 4 additions & 4 deletions examples/webhook-signing/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ router.post('/webhooks', addRawBody, function(request, response) {
// Try adding the Event as `request.event`
event = telnyx.webhooks.constructEvent(
request.rawBody,
request.headers['telnyx-signature'],
request.headers['telnyx-timestamp'],
request.header('telnyx-signature-ed25519'),
request.header('telnyx-timestamp'),
publicKey
);
} catch (e) {
Expand All @@ -61,10 +61,10 @@ router.post('/webhooks', addRawBody, function(request, response) {
return response.status(400).send('Webhook Error:' + e.message);
}

console.log('Success', event.id);
console.log('Success', event.data.id);

// Event was 'constructed', so we can respond with a 200 OK
response.status(200).send('Signed Webhook Received: ' + event.id);
response.status(200).send('Signed Webhook Received: ' + event.data.id);
});

// You could either create this app, or just return the `Router` for use in an
Expand Down
4 changes: 2 additions & 2 deletions examples/webhook-signing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": { },
"scripts": {},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.17.1",
"express": "^4.15.2",
"morgan": "^1.8.1",
"telnyx": "^1.0.0"
"telnyx": "^1.2.1"
}
}

0 comments on commit 89c485d

Please sign in to comment.