mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-06-16 21:10:26 +08:00
fix(api): 🐛 subscribeWebhook upsert
This commit is contained in:
parent
1423c14547
commit
cfbea6bbba
@ -24,9 +24,10 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const { webhookId } = typebot.blocks
|
||||
.find(byId(blockId))
|
||||
?.steps.find(byId(stepId)) as WebhookStep
|
||||
await prisma.webhook.update({
|
||||
await prisma.webhook.upsert({
|
||||
where: { id: webhookId },
|
||||
data: { url, body: '{{state}}', method: 'POST' },
|
||||
update: { url, body: '{{state}}', method: 'POST' },
|
||||
create: { url, body: '{{state}}', method: 'POST', typebotId },
|
||||
})
|
||||
|
||||
return res.send({ message: 'success' })
|
||||
|
||||
Loading…
Reference in New Issue
Block a user