Skip to main content

Zapier Hook Tool

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_zapierhook


Swarmauri Tool · Zapier Hook

A Swarmauri tool that triggers Zapier catch webhooks from within agent workflows. Use it to hand off conversation state to Zapier automations—send notifications, update CRMs, open tickets, or kick off custom Zaps with a single function call.

  • Accepts JSON payloads as strings and posts them to a Zapier webhook URL.
  • Surfaces the Zapier HTTP response (success or failure) in a structured dictionary.
  • Built on requests so you can extend headers, authentication, or timeout behaviour if required.

Requirements

  • Python 3.10 – 3.13.
  • A Zapier webhook URL (copy from Zap setup → Webhooks by ZapierCatch Hook). Store it securely (environment variables, secrets manager).
  • Dependencies (requests, swarmauri_base, swarmauri_standard, pydantic) install automatically with the package.

Installation

Pick the packaging workflow that fits your project; each command installs dependencies.

pip

pip install swarmauri_tool_zapierhook

Poetry

poetry add swarmauri_tool_zapierhook

uv

# Add to the current project and update uv.lock
uv add swarmauri_tool_zapierhook

# or install into the active environment without editing pyproject.toml
uv pip install swarmauri_tool_zapierhook

Tip: Treat the webhook URL like a secret. Avoid hardcoding it in source control and prefer environment variables.

Quick Start

import json
import os
from swarmauri_tool_zapierhook import ZapierHookTool

zap_url = os.environ["ZAPIER_WEBHOOK_URL"]
zap_tool = ZapierHookTool(zap_url=zap_url)

payload = json.dumps({
    "message": "Hello from Swarmauri!",
    "source": "webhook-demo"
})

result = zap_tool(payload)
print(result["zap_response"])

ZapierHookTool wraps the payload in a JSON object ({"data": payload}) before posting, matching the expectations of most Zapier catch hooks.

Usage Scenarios

Forward Agent Decisions to Zapier

from swarmauri_core.agent.Agent import Agent
from swarmauri_core.messages.HumanMessage import HumanMessage
from swarmauri_standard.tools.registry import ToolRegistry
from swarmauri_tool_zapierhook import ZapierHookTool

registry = ToolRegistry()
registry.register(ZapierHookTool(zap_url=os.environ["ZAPIER_WEBHOOK_URL"]))
agent = Agent(tool_registry=registry)

message = HumanMessage(content="log a follow-up task for the sales team")
response = agent.run(message)
print(response)

The agent can serialize conversation context, send it to Zapier, and continue the dialogue with confirmation details.

Escalate Incidents From Monitoring Scripts

import json
import os
from swarmauri_tool_zapierhook import ZapierHookTool

zap_tool = ZapierHookTool(zap_url=os.environ["INCIDENT_ZAP_URL"])
alert = {
    "service": "payments",
    "severity": "critical",
    "message": "Latency exceeded threshold"
}

result = zap_tool(json.dumps(alert))
print("Zapier response:", result["zap_response"])

Trigger a Zap that files tickets, posts to Slack, or updates status pages when your monitoring detects issues.

Batch Replay Events

import json
import os
from swarmauri_tool_zapierhook import ZapierHookTool

zap_tool = ZapierHookTool(zap_url=os.environ["EVENT_ZAP_URL"])
with open("events.json") as fh:
    events = json.load(fh)

for event in events:
    payload = json.dumps(event)
    zap_tool(payload)

Replay queued events into Zapier when systems come back online.

Troubleshooting

  • requests.exceptions.HTTPError – Zapier returned a non-200 status (often 401 due to malformed or revoked URLs). Check the webhook URL and payload format.
  • Timeouts or connection errors – Ensure the environment has outbound internet access and consider wrapping the tool to set explicit timeouts or retries.
  • Zap expects structured JSON – The tool sends {"data": payload}. Adjust your Zap’s “Catch Hook” step or extend the tool if you need different envelope fields.

License

swarmauri_tool_zapierhook is released under the Apache 2.0 License. See LICENSE for full details.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swarmauri_tool_zapierhook-0.8.3.dev10.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file swarmauri_tool_zapierhook-0.8.3.dev10.tar.gz.

File metadata

  • Download URL: swarmauri_tool_zapierhook-0.8.3.dev10.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_tool_zapierhook-0.8.3.dev10.tar.gz
Algorithm Hash digest
SHA256 0a8d4adc684f36bc328484ef7a039877d10dbe01f5fda14383d493c2b36c2b2b
MD5 d7bd424bb14135347677f0f90c35fe35
BLAKE2b-256 17563e6ec3deefd6e90b260559740162f96d40f3d00dd6b3ec4b0754774b2f9b

See more details on using hashes here.

File details

Details for the file swarmauri_tool_zapierhook-0.8.3.dev10-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_zapierhook-0.8.3.dev10-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_tool_zapierhook-0.8.3.dev10-py3-none-any.whl
Algorithm Hash digest
SHA256 7431d91860c1e2d489e2d7c88d86466d7c82b2b2d947f741df16019c6d7cd5ff
MD5 5a21c04fc2be76f547618d19a3219c54
BLAKE2b-256 7c2f285b8fe37831787d2e8b60f4a9c091d1deaf6c1fcd9a4a09e29f3400ad07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page