Web trigger events

Web triggers are incoming HTTP calls that invoke a function. Such as, from a third-party webhook implementation. Web triggers are configured in the app’s manifest and the URL to call is created through the Forge CLI.

The request is serialized to JSON and passed to the function in the format described below. The function that is invoked is responsible for parsing the JSON data.

The HTTP response is formed from the JSON format described below. If the function result is not compatible with the JSON format, then an error response with status code 500 is sent.

Request

PropertyTypeRequiredDescription
bodystringHTTP request body.
headersobject

HTTP headers sent by the caller.

Format

1
nameOfTheHeader: array of strings

Example

1
"Content-Type”: ["application/json”]

methodstringYesHTTP method used by the client. For example, GET, POST, PUT, or DELETE.
pathstringYesPath of request sent by the caller.
*anyAdditional properties are provided to support forward compatibility.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
  "method": "POST",
  "headers": {
    "Accept": [
      "*/*"
    ],
    "Postman-Token": [
      "5249865e-4106-447d-aa17-52df5e57c2b9"
    ],
    "accept-encoding": [
      "gzip, deflate"
    ],
    "User-Agent": [
      "PostmanRuntime/7.13.0"
    ],
    "content-length": [
      "71"
    ],
    "Connection": [
      "keep-alive"
    ],
    "Host": [
      "localhost:8080"
    ],
    "Cache-Control": [
      "no-cache"
    ],
    "Content-Type": [
      "text/plain"
    ]
  },
  "body": "{\n\t\"hello\": 1,\n\t\"test\": [\"foo\", \"bar\"],\n\t\"foo\": {\n\t\t\"bar\": \"hello\"\n\t}\n}",
  "path": "/eyAgImN0eCI6ICJhcmk6Y2xvdWQ6amlyYTo6c2l0ZS9hMDhmNDU0Mi01Y2VjLTExZTktYTVhMC00N2Q3ZTY0NTlmOTEiLCAgImRlZiI6ICIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDIiLCAgImV4dCI6ICJqaXJhLWNvbW1lbnQtdHJpZ2dlciIsICAidGFnIjogInNsYWNrIn0"
}

Response

PropertyTypeRequiredDescription
bodystringHTTP response body sent back to the caller.
headersobject

HTTP headers sent by the caller.

Format

1
nameOfTheHeader: array of strings

Example

1
"Content-Type": ["application/json"]

statusCodeintegerYesHTTP status code returned to the caller.
statusTextstringText returned to communicate status. The text provides context to the status code.
*anyAdditional properties are provided to support forward compatibility.