Discussions
Webhook question
almost 2 years ago by jonathanlarson2
I have this react code:
// Handle the initial POST request
app.post('/create-talk', (req, res) => {
try {
sdk.auth(AUTH_TOKEN); // Authenticate with the provided authorization token
sdk.createTalk({
script: {
type: 'text',
subtitles: 'false',
provider: {
type: 'microsoft',
voice_id: 'en-US-JennyNeural'
},
ssml: 'false',
input: 'This is a story about a story',
},
config: {
fluent: 'false',
pad_audio: '0.0'
},
// webhook: 'https://localhost:8000/webhook',
source_url: 'https://cdn.discordapp.com/attachments/1117865131272052787/1119006849920934019/jonlarsony_just_one_person_ecb819fc-68db-4c5a-a49f-345273413a79.png'
})
.then(({ data }) => res.json(data.id))
.catch(error => {
console.error(error);
res.status(500).json({ error: 'An error occurred' });
});
} catch (error) {
console.error(error);
res.status(500).json({ error: 'An error occurred' });
}
});
app.post('/webhook', (req, res) => {
const talkId = req.body; // Assuming the talk ID is included in the request body
console.log(talkId);
// Handle the webhook request and retrieve the necessary information
// Perform any required operations with the talk ID
res.sendStatus(200); // Send a success response to the webhook request
});
but I can't get the full response back like i do we I use webhook.site for my webhook.
What I am doing wrong?