T
TypebotRuss Webb

Stumped on webhook return value

I think I've tried every possible variation, and even turned to ChatGPT to help, to avail. I am trying to use the 'set variable' block to trigger a webhook, return a response, and save the response to the variable but I'm not getting anything to display. Here's the code inside the 'set variable' block with a variable name of 'authorization': const webhookUrl = 'https://api.pbt.io/v2/96d049d4-613c-4623-8f5a-3c8cc577da54'; const response = await fetch(webhookUrl, { method: 'POST', // or 'PUT' headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ 'location': {{location}}, 'authorization_code': {{authorization_code}} }) }); const authorization = await response.json; return JSON.stringify(authorization); The values being sent to the webhook are working perfectly. The value being returned from the webhook is a simple JSON as follows: [ { "authorization": "authorization failed" } ] I then have another block right after where I display the 'authorization' in a text block but it comes up blank. Nothing appears in the console for errors or anything else. All I want to do is populate the 'authorization' variable with the response value from the webhook.
Baptiste
Baptiste•18d ago
The HTTP Request is made for this Is there any reason why you are not using the HTTP request block? https://docs.typebot.io/editor/blocks/integrations/webhook
Russ Webb
Russ Webb•18d ago
Well, now that makes way more sense. Sometimes it's hard to see the forest through the trees! Thanks dude!
Baptiste
Baptiste•17d ago
No problem 😄
Want results from more Discord servers?
Add your server
More Posts
Wait for two or more messages before continuingHey team, has anyone managed to make typebot wait for 2 messages, or collect 2 messages before contiWhatsapp Webhook ResponseWhen we integrate whatsapp on typebot its auto generate webhook on typebot, its possible to get the Repeated buttons from Sheets databaseWhen using sheets as a database with the HTTP request the expectation is that repeated text in a colGlobal webhookI want to integrate typebot with my own system so I need a way to be notified of any incoming or outGetting 404 trying to startChat & startChat preview APIHi, is possible someone can help me how to start a Chat? I follow this guide but looks like I'm misUsing Ask Assistant with Basic ChatGPT Template ?Hi Everyone; Via the OpenAI Playground I have an assistant which have a good VectorDB and I would lAppend messagesProbably a silly question but, do we manually append user and assistant messages to the chat historyElevenLabs audio not showing up on desktopI have added a Elevenlabs component, it works in the Flow editor, but when accessed in the desktop uThe forgeI have a problem, my action is being executed prematurely, what can I do to solve it?Fetcher not running on changing option in a custom componentCurrent action code: ```js export const invoke = createAction({ name: 'Invoke', baseOptions, Unable to view Pdf in mobile appHello, I'm having trouble viewing PDFs in the mobile app. The integration was completed using FlutteError saving credential (Invalid discriminator value)I created a component with the documentation command, but when I try to save the authentication it r