Skip to content

Commit

Permalink
fix swagger servers and error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
avoylenko committed Feb 16, 2024
1 parent d3baebd commit 11eb22f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { globalApiKey, disabledCallbacks } = require('./config')
// Trigger webhook endpoint
const triggerWebhook = (webhookURL, sessionId, dataType, data) => {
axios.post(webhookURL, { dataType, data, sessionId }, { headers: { 'x-api-key': globalApiKey } })
.catch(error => console.error('Failed to send new message webhook:', sessionId, dataType, error.message, data))
.catch(error => console.error('Failed to send new message webhook:', sessionId, dataType, error.message, data || ''))
}

// Function to send a response with error status and message
Expand Down
10 changes: 10 additions & 0 deletions swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ const doc = {
title: 'WhatsApp API',
description: 'API Wrapper for WhatsAppWebJS'
},
servers: [
{
url: '',
description: ''
},
{
url: 'http://localhost:3000',
description: 'localhost'
}
],
securityDefinitions: {
apiKeyAuth: {
type: 'apiKey',
Expand Down
10 changes: 9 additions & 1 deletion swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
},
"servers": [
{
"url": "http://localhost:3000/"
"url": "",
"description": ""
},
{
"url": "http://localhost:3000",
"description": "localhost"
}
],
"tags": [
Expand All @@ -31,6 +36,7 @@
"Various"
],
"description": "",
"parameters": [],
"responses": {
"200": {
"description": "OK"
Expand Down Expand Up @@ -411,6 +417,7 @@
],
"summary": "Terminate inactive sessions",
"description": "Terminates all inactive sessions.",
"parameters": [],
"responses": {
"200": {
"description": "Sessions terminated.",
Expand Down Expand Up @@ -457,6 +464,7 @@
],
"summary": "Terminate all sessions",
"description": "Terminates all sessions.",
"parameters": [],
"responses": {
"200": {
"description": "Sessions terminated.",
Expand Down

0 comments on commit 11eb22f

Please sign in to comment.