https://retellai.com/?utm_source=discord&utm_medium=seo logo
I am having issues with the signature verification
# ❓・ai-evy-support
p
@AI Evy I am having issues with the signature verification. I've used every webhook API secret and its still failing.
a
Thanks for tagging me @petejaws_39681. I'll look through relevant sources and get back to you shortly.
## Common Issues to Check From community discussions, signature verification can fail due to: 1. Special characters in transcripts - If your transcript contains special characters (like accented characters) , this can cause verification issues [(2) ]() 2. JSON encoding - Adding
ensure_ascii=False
to JSON dump operations may help resolve encoding-related signature verification failures 3. API key format - Ensure your API key doesn't contain weird characters that might cause parsing issues [(3) ]() ## Verification Requirements You can also allowlist Retell IP addresses:
100.20.5.228
[(1) ]() . The webhook uses the
x-retell-signature
header together with your Retell API Key to verify authenticity . If you're still having issues after checking these points, ensure you're using the Retell SDK's built-in
verify
function rather than implementing custom signature verification.
### Answer Based on the documentation, here are the key steps to properly verify webhook signatures in Retell AI: ## Use the Correct API Key Only the API key that has a webhook badge next to it can be used to verify the webhook [(1) ]() . Make sure you're using the webhook-enabled API key, not just any regular API key. ## Proper Implementation Here's the exact code from the documentation for webhook verification:
Copy code
javascript
// install the sdk: <https://docs.retellai.com/get-started/sdk>
import { Retell } from "retell-sdk";
import express, { Request, Response } from "express";
const app = express() ;
app.use(express.json() ) ;
app.post("/webhook", (req: Request, res: Response) => {
 if (
 !Retell.verify(
 JSON.stringify(req.body) ,
 process.env.RETELL_API_KEY,
 req.headers["x-retell-signature"] as string,
 )
 ) {
 console.error("Invalid signature") ;
 return;
 }
 const {event, call} = req.body;
 // process the webhook
 // Acknowledge the receipt of the event
 res.status(204) .send() ;
}) ;
​ To learn more, see the sources I considered: [[1] Secure the webhook](https://docs.retellai.com/features/secure-webhook) [[2] Webhook signature fails verification](https://discord.com/channels/1186424376300679209/1257584657172529183) [[3] Discord message from @spartacus20 on 2024-05-14](https://discord.com/channels/1186424376300679209/1186462578310910112/1239890880500994049) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.