https://retellai.com/?utm_source=discord&utm_medium=seo logo
- can i know what ip addresses will send webhook i...
# ❓・ai-evy-support
d
@AI Evy - can i know what ip addresses will send webhook information so i'll know to restrict my firewall to just these ips ?
a
Thanks for tagging me @dj.ufk. I'll look through relevant sources and get back to you shortly.
### Answer Yes, Retell AI webhooks are sent from a specific IP address that you can allowlist in your firewall. [(1) ]() [(2) ]() [(3) ]() The IP address to allowlist is:
100.20.5.228
In addition to IP allowlisting, you can also verify webhooks using the
x-retell-signature
header together with your Retell API Key. [(1) ]() [(3) ]() Retell AI provides a verify function in their SDKs to help with this verification. [(1) ]() **
​ To learn more, see the sources I considered: [[1] Secure the webhook](https://docs.retellai.com/features/secure-webhook) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] Retell AI Webhooks | AI Voice Agents With Live Data | Retell AI](https://www.retellai.com/blog/retell-ai-webhooks-feature) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
@AI Evy - so 100.20.5.228 is the only ip address? in general it's enough if i strict it only by ip address ?
a
Thanks for the follow-up, @dj.ufk. I'll get back to you soon.
### Answer Yes,
100.20.5.228
is the IP address documented for allowlisting Retell webhooks. [(1) ]() However, IP allowlisting alone is not recommended as the only security measure. Retell AI provides an additional verification method using the
x-retell-signature
header together with your Retell API Key to verify that webhooks actually come from Retell AI, not from a malicious third party. Retell provides a verify function in their SDKs specifically for this purpose. Here's an example of how to implement both IP allowlisting and signature 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() ;
}) ;
**Best practice**: Use both IP allowlisting AND signature verification for maximum security.
​ To learn more, see the sources I considered: [[1] Secure the webhook](https://docs.retellai.com/features/secure-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
@AI Evy - do you have one for python ?
a
Thanks for the follow-up, @dj.ufk. I'll get back to you soon.
### Answer Yes, here's the Python example for webhook verification with IP allowlisting: [(1) ]()
Copy code
python
# install the sdk: <https://docs.retellai.com/get-started/sdk>
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse

from retell import Retell
retell = Retell(api_key=os.environ["RETELL_API_KEY"])
@app.post("/webhook")
async def check-weather(request: Request) :
    try:
        post_data = await request.json()
        valid_signature = retell.verify(
            json.dumps(post_data, separators=(",", ":") , ensure_ascii=False) ,
            api_key=str(os.environ["RETELL_API_KEY"]) ,
            signature=str(request.headers.get("X-Retell-Signature") ) ,
        )
        if not valid_signature:
            print(
                "Received Unauthorized",
                post_data["event"],
                post_data["data"]["call_id"],
            )
            return JSONResponse(status_code=401, content={"message": "Unauthorized"})
        args = post_data["args"]
        if args["city"] == "New York":
            return JSONResponse(status_code=200, content={"result": "25f and sunny"})
        else:
            return JSONResponse(status_code=200, content={"result": "20f and cloudy"})
    except Exception as err:
        print(f"Error in webhook: {err}")
        return JSONResponse(
            status_code=500, content={"message": "Internal Server Error"}
        )
[(2) ]() You can also secure your server by allowlisting the Retell IP address:
100.20.5.228
[(1) ]() [(2) ]()
​ To learn more, see the sources I considered: [[1] Secure the webhook](https://docs.retellai.com/features/secure-webhook) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
@AI Evy - i added retell to requirements.txt but there is no such package
a
Thanks for the follow-up, @dj.ufk. I'll get back to you soon.
### Answer The correct package name for Python is
retell-sdk
, not
retell
.
[(1) ]() In your
requirements.txt
, you should add:
Copy code
retell-sdk
You can also install it directly using:
Copy code
pip install retell-sdk
Then in your Python code, you import it as:
Copy code
python
from retell import Retell
The package name on PyPI is
retell-sdk
, but you import it as
retell
in your code.
​ To learn more, see the sources I considered: [[1] SDKs](https://docs.retellai.com/get-started/sdk) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.