HTTP

Sym lets you make arbitrary HTTP requests to trigger remote procedures.

Overview

For remote procedure calls that don't aren't housed in a Lambda function, you can use Sym's HTTP integration to invoke whatever's living behind a remote URL. This Integration can be declared directly in your Terraform.

Using HTTP in your Terraform

With Sym's HTTP Strategy, you can easily trigger escalations in any service, third or first party, that is accessible over HTTP. The most basic implementation of this uses Sym's default payload, which is shared with the AWS Lambda Integration and Reporting module.

To get started, simply create a sym_strategy of type http, and create one or more targets which define a method and url.

Example implementation

resource "sym_strategy" "http" {
  type    = "http"
  name    = "http-strategy"
  targets = [sym_target.http.id]
}

resource "sym_target" "http" {
  type  = "http_request"
  name  = "http-target"
  label = "HTTP Target"

  settings = {
    method = "POST"
    url    = "https://requestbin.net/r/6yqd5gq1"
  }
}

Advanced example

More advanced use cases will require sending a custom body or headers. You can specify these with additional settings, and can use Python f-string formatting to interpolate anything from the Event. You can also specify Secrets to be made available for this interpolation.

resource "sym_secret" "api_key" {
  name = "api_key"
  path = "/symops.com/api_key"
  source_id = var.sym_secrets_source_id
}

resource "sym_strategy" "http" {
  type     = "http"
  name     = "http-strategy"
  targets  = [sym_target.http.id]
  settings = {
    secret_ids = [sym_secret.api_key.id]
  }
}
 
resource "sym_target" "http" {
  type  = "http_request"
  name  = "http-target"
  label = "HTTP Target"

  settings = {
    method       = "POST"
    url          = "https://requestbin.net/r/6yqd5gq1"
    headers_json = jsonencode({"X-API-Key": "{s.api_key}"})
    body_json    = jsonencode({"email": "{evt.user.email}"})
  }
}

πŸ‘

You can also use HTTP in your Flows!

For information about Sym's HTTP SDK integration, see our usage examples and SDK docs.


What’s Next
Did this page help you?