Skip to content

Commit

Permalink
⚡ (webhook) Add custom timeout option
Browse files Browse the repository at this point in the history
Closes #1128
  • Loading branch information
baptisteArno committed Jan 4, 2024
1 parent d247e02 commit 34917b0
Show file tree
Hide file tree
Showing 9 changed files with 241 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ import { VariableForTestInputs } from './VariableForTestInputs'
import { SwitchWithRelatedSettings } from '@/components/SwitchWithRelatedSettings'
import {
HttpMethod,
defaultTimeout,
defaultWebhookAttributes,
defaultWebhookBlockOptions,
maxTimeout,
} from '@typebot.io/schemas/features/blocks/integrations/webhook/constants'
import { NumberInput } from '@/components/inputs'

type Props = {
blockId: string
Expand Down Expand Up @@ -81,6 +84,9 @@ export const WebhookAdvancedConfigForm = ({
const updateIsCustomBody = (isCustomBody: boolean) =>
onOptionsChange({ ...options, isCustomBody })

const updateTimeout = (timeout: number | undefined) =>
onOptionsChange({ ...options, timeout })

const executeTestRequest = async () => {
if (!typebot) return
setIsTestResponseLoading(true)
Expand Down Expand Up @@ -196,6 +202,22 @@ export const WebhookAdvancedConfigForm = ({
)}
</AccordionPanel>
</AccordionItem>
<AccordionItem>
<AccordionButton justifyContent="space-between">
Advanced parameters
<AccordionIcon />
</AccordionButton>
<AccordionPanel pt="4">
<NumberInput
label="Timeout (s)"
defaultValue={options?.timeout ?? defaultTimeout}
min={1}
max={maxTimeout}
onValueChange={updateTimeout}
withVariableButton={false}
/>
</AccordionPanel>
</AccordionItem>
<AccordionItem>
<AccordionButton justifyContent="space-between">
Variable values for test
Expand Down
9 changes: 9 additions & 0 deletions apps/builder/src/pages/api/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { NextApiRequest, NextApiResponse } from 'next'

export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
await new Promise((resolve) => setTimeout(resolve, 11000))
res.status(200).json({ name: 'John Doe' })
}
4 changes: 4 additions & 0 deletions apps/docs/editor/blocks/integrations/webhook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ Possibilities are endless when it comes to API calls, you can litteraly call any

Feel free to ask the [community](https://typebot.io/discord) for help if you struggle setting up a Webhook block.

## Timeout

By default, the Webhook block will wait 10 seconds for the 3rd party service to respond. If it doesn't respond in time, the block will fail. You can customize this timeout value in the "Advanced params" section of your Webhook block settings.

## Troubleshooting

The Webhook block request fail or didn't seem to trigger? Make sure to check the [logs](/results/overview#logs). If you still can't figure out what went wrong, shoot me a message using the chat button directly in the tool 👍
120 changes: 120 additions & 0 deletions apps/docs/openapi/builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -1863,6 +1868,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -2077,6 +2087,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -2226,6 +2241,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -7595,6 +7615,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -8047,6 +8072,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -8261,6 +8291,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -8410,6 +8445,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -12096,6 +12136,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -12548,6 +12593,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -12762,6 +12812,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -12911,6 +12966,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -25701,6 +25761,11 @@
"type": "string"
}
}
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
}
Expand Down Expand Up @@ -26144,6 +26209,11 @@
"type": "string"
}
}
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
}
Expand Down Expand Up @@ -26349,6 +26419,11 @@
"type": "string"
}
}
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
}
Expand Down Expand Up @@ -26489,6 +26564,11 @@
"type": "string"
}
}
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
}
Expand Down Expand Up @@ -28977,6 +29057,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -29429,6 +29514,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -29643,6 +29733,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -29792,6 +29887,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -31766,6 +31866,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -32218,6 +32323,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -32432,6 +32542,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down Expand Up @@ -32581,6 +32696,11 @@
"required": [
"id"
]
},
"timeout": {
"type": "number",
"minimum": 1,
"maximum": 120
}
}
},
Expand Down
Loading

3 comments on commit 34917b0

@vercel
Copy link

@vercel vercel bot commented on 34917b0 Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

goldorayo.com
govsaques.com
headsbet.info
implant35.com
majie.move.sg
payforbet.com
rabbit.cr8.ai
saquegov.site
shop.mexwa.my
signup.cr8.ai
start.taxt.co
thegymgame.it
theusm.com.br
turkey.cr8.ai
vhpage.cr8.ai
vitamyway.com
webwhats.chat
whatchat.site
www.wiccom.it
acessovip.shop
adsgrow.com.br
am.nigerias.io
an.nigerias.io
app.yvon.earth
ar.nigerias.io
bot.enreso.org
bot.mail2wa.me
bot.rslabs.pro
bot.share5.net
bot.sussmeg.hu
bot.wachap.app
bots.bng.tools
bots.bridge.ai
chad.gocto.com
chat.ftplay.me
chat.hayuri.id
chat.uprize.hu
chatgpt.lam.ee
chicken.cr8.ai
debitozero.com
drayumi.social
flourcrown.com
gollum.riku.ai
gsbulletin.com
journey.cr8.ai
kopibayane.com
panther.cr7.ai
panther.cr8.ai
pay.sifuim.com
penguin.cr8.ai
petaikorea.com
privetvplus.me
segredomeu.com
semaknilai.com
talk.gocare.io
ticketfute.com
unicorn.cr8.ai
whats-app.chat
whatsnaweb.com
apo.nigerias.io
viewer-v2-typebot-io.vercel.app
mdb.assessoria.mauricio.progenbr.com
mdb.evento.autocadastro.progenbr.com
form.shopmercedesbenzsouthorlando.com
mdb.evento.equipeinterna.progenbr.com
bot.studiotecnicoimmobiliaremerelli.it
mdb.assessoria.boaventura.progenbr.com
mdb.assessoria.jtrebesqui.progenbr.com
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
gabinete.baleia.formulario.progenbr.com
mdb.assessoria.carreirinha.progenbr.com
chrome-os-inquiry-system.itschromeos.com
mdb.assessoria.paulomarques.progenbr.com
viewer-v2-git-main-typebot-io.vercel.app
main-menu-for-itschromeos.itschromeos.com
mdb.assessoria.qrcode.ademir.progenbr.com
mdb.assessoria.qrcode.arthur.progenbr.com
mdb.assessoria.qrcode.danilo.progenbr.com
mdb.assessoria.qrcode.marcao.progenbr.com
mdb.assessoria.qrcode.marcio.progenbr.com
mdb.assessoria.qrcode.aloisio.progenbr.com
mdb.assessoria.qrcode.girotto.progenbr.com
mdb.assessoria.qrcode.marinho.progenbr.com
mdb.assessoria.qrcode.rodrigo.progenbr.com
mdb.assessoria.carlosalexandre.progenbr.com
mdb.assessoria.qrcode.desideri.progenbr.com
mdb.assessoria.qrcode.fernanda.progenbr.com
mdb.assessoria.qrcode.jbatista.progenbr.com
mdb.assessoria.qrcode.mauricio.progenbr.com
mdb.assessoria.fernanda.regional.progenbr.com
mdb.assessoria.qrcode.boaventura.progenbr.com
mdb.assessoria.qrcode.jtrebesqui.progenbr.com
mdb.assessoria.qrcode.carreirinha.progenbr.com
mdb.assessoria.qrcode.paulomarques.progenbr.com
mdb.assessoria.qrcode.carlosalexandre.progenbr.com
mdb.assessoria.qrcode.fernanda.regional.progenbr.com
www.typebot.io
get-typebot.com
www.get-typebot.com

@vercel
Copy link

@vercel vercel bot commented on 34917b0 Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

landing-page-v2 – ./apps/landing-page

landing-page-v2-typebot-io.vercel.app
landing-page-v2-git-main-typebot-io.vercel.app
home.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 34917b0 Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io

Please sign in to comment.