Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions examples/webhook_navigation_blocked.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os

from examples import bb

# An HTTPS endpoint you control, for example https://example.com/browserbase/events
WEBHOOK_ENDPOINT = os.environ["WEBHOOK_ENDPOINT"]


def run() -> None:
# Browserbase sends one event for each navigation a session's navigation policy blocks,
# with the session, the URL and when it was decided. Allowed navigations send none.
webhook = bb.webhooks.create(
endpoint=WEBHOOK_ENDPOINT,
event_types=["sessions.navigations.blocked"],
)
print(f"Webhook {webhook.id} receives {', '.join(webhook.event_types)}")

# The signing secret is returned only here and when it is rotated. Store it to verify
# the signature on every delivery.
print(f"Signing secret starts with {webhook.secret[:6]}")


if __name__ == "__main__":
run()
Loading