HTTP
Use Sym's HTTP SDK integration to insert side effects throughout your Flows.
Overview
By making arbitrary HTTP requests from your Handlers, you can query internal data stores, trigger side effects in third-party APIs, and more.
This is an advanced Integration
It's easy to shoot yourself in the foot! With great power comes great responsibility.
Example implementations
Delegating routing to an external service
from sym.sdk.annotations import reducer
from sym.sdk.integrations.dangerous import http
@reducer
def get_approvers(evt):
body = {"target": evt.target}
resp = http.get("https://gatekeeper.healthy-health.co", body)
return slack.group(resp["emails"])
Fetching external state
from sym.sdk.annotations import reducer
from sym.sdk.integrations.dangerous import http
@reducer
def get_approvers(evt):
email = evt.user.email
resp = http.get(f"https://people.healthy-health.co?email={email}")
if resp["is_manager"]:
# Self-approval:
return slack.user(evt.user)
Triggering a side-effect
from sym.sdk.annotations import hook
from sym.sdk.integrations.dangerous import http
@hook
def on_request(evt):
body = {"user": evt.user.email, "message": "requested access"}
http.post(f"https://audit.healthy-health.co", body)
You can also use our HTTP Strategy to trigger RPCs
Check out the Terraform examples for our HTTP Strategy here.
Updated 5 months ago
Did this page help you?