I only created one webhook in my dev environment, and it was working great for a while. But now I am getting an error that I have too many active webhooks.
As far as I know, this team only had one active webhook.
const express = require('express')
const bodyParser = require('body-parser')
const ngrok = require('ngrok')
const axios = require('axios')
const crypto = require('crypto')
require('dotenv').config();
const PORT = 3000
const app = express()
const passcode = crypto.randomBytes(48).toString('hex')
app.use(bodyParser.json())
app.post('/', (request, response) => {
if (request.body.passcode === passcode) {
const { file_name, timestamp, triggered_by, version, description } = request.body
handle_value = triggered_by["handle"]
console.log(handle_value)
console.log(`${file_name} was updated at ${timestamp}. Last updated by ${triggered_by}. ${description}`)
response.sendStatus(200)
} else {
response.sendStatus(403)
}
})
app.listen(PORT, () => console.log(`🚀 Server running on port ${PORT}`))
ngrok.connect(PORT).then(async (endpoint) => {
const response = await axios({
url: 'https://api.figma.com/v2/webhooks',
method: 'post',
headers: {
'X-Figma-Token': process.env.FIGMA_API_KEY,
},
data: {
file_key: process.env.FIGMA_DOC_ID,
event_type: 'LIBRARY_PUBLISH',
team_id: process.env.FIGMA_TEAM_ID,
passcode,
endpoint,
},
})
console.log(`🎣 Webhook ${response.data.id} successfully created`)
})
The error message
data: {
error: true,
status: 400,
message: 'Webhook Limit Exceeded',
i18n: null,
reason: 'You have reached the max number of active webhooks for this team. To add another, delete an existing webhook.'
}