OpenAI Assistants API + FetchHook: Persistent Webhook Triggers
Give your OpenAI Assistants the ability to 'check the mail.' FetchHook provides the persistent buffer needed to feed real-time events into OpenAI threads without a public proxy.
Assistant Tool for Webhooks
# Define this as a tool in your OpenAI Assistant
def get_webhook_data():
"""Fetches new external events from my FetchHook mailbox."""
res = requests.get("https://api.fetchhook.app/api/v1/stash_123",
headers={"Authorization": "Bearer fh_xxx"})
return res.json()#How do I give my OpenAI Assistant memory for webhooks?
The Assistants API is great at maintaining thread state, but it can't natively 'listen' for webhooks. By exposing FetchHook as a 'Function Tool,' you allow the Assistant to autonomously decide when to pull new data. When the user asks 'Are there any new Stripe payments?', the Assistant calls the tool, parses the FetchHook JSON, and provides an answer.
#Automated Polling Loops
For fully autonomous workflows, you can wrap your Assistant in a simple polling loop. Every minute, your script pulls from FetchHook; if new events are found, it adds them as a message to an existing thread and runs the Assistant to generate a summary or action.
Agent Protocol Instruction