BrightMan
10/07/2024, 1:43 PMVapi
10/07/2024, 1:45 PMVapi
10/07/2024, 1:45 PMtoolCallId and result.
2. The second example wraps the result in an array, which could be useful if there are multiple results to return.
To read the response, you would:
- Wait for the HTTP POST request to your webhook URL.
- Parse the JSON payload from the body of the request.
- Access the data you need using the appropriate keys. For example, if you're looking for the result, you would access it using response.result for the first structure, or response.results[0].result for the second structure if you're expecting an array.
Here's a simple example in JavaScript using Express:
javascript
const express = require('express');
const app = express();
app.use(express.json());
app.post('/webhook', (req, res) => {
// Assuming the first JSON structure
const toolCallId = req.body.toolCallId;
const result = req.body.result;
// Do something with toolCallId and result
console.log(`Received toolCallId: ${toolCallId} with result: ${result}`);
// Send a response back to acknowledge receipt
res.status(200).send('Received');
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});
Make sure to validate the structure of the JSON payload you're expecting and handle any potential errors or different formats accordingly. If you're unsure about the structure of the response that make.com will send, you may need to consult their documentation or reach out to their support for more information.Vapi
10/07/2024, 1:45 PMVapi
10/07/2024, 1:47 PMBrightMan
10/07/2024, 2:53 PMBrightMan
10/07/2024, 2:53 PMShubham Bajaj
10/07/2024, 7:28 PMjson
{
"results": [
{
"toolCallId": "X",
"result": "Y"
}
]
}BrightMan
10/07/2024, 8:03 PMBrightMan
10/07/2024, 8:03 PMShubham Bajaj
10/09/2024, 3:03 PMShubham Bajaj
10/10/2024, 7:31 PM