Skip to content

On action change callback ​

API Reference

Note: The path is a placeholder. The actual path is determined by the configuration of the app component.

The callback request made to an app server when a watched field's value changes within an action form. The request is subject to a 10-second timeout if no response is received from the app server.

OpenAPI definition ​

json
{
  "openapi": "3.0.0",
  "info": {
    "description": "This is the interface for handling requests for app components. This reference is generated from an [OpenAPI spec] (https://raw.githubusercontent.com/Asana/openapi/master/defs/app_components_oas.yaml).",
    "title": "App Components",
    "termsOfService": "https://asana.com/terms",
    "contact": {
      "name": "Asana Support",
      "url": "https://asana.com/support"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0"
    },
    "version": "0.1",
    "x-docs-schema-whitelist": [
      "AttachedResourceResponse",
      "FormField-Checkbox",
      "FormField-Date",
      "FormField-Datetime",
      "FormField-Dropdown",
      "FormField-MultiLineText",
      "FormField-RadioButton",
      "FormField-RichText",
      "FormField-SingleLineText",
      "FormField-StaticText",
      "FormField-Typeahead",
      "FormMetadataResponse",
      "RanActionResponse",
      "WidgetFooter-CustomText",
      "WidgetFooter-Created",
      "WidgetFooter-Updated",
      "WidgetMetadataResponse",
      "WidgetField-DatetimeWithIcon",
      "WidgetField-Pill",
      "WidgetField-TextWithIcon",
      "TypeaheadListResponse",
      "TypeaheadItem",
      "FormValues",
      "BadRequestResponse",
      "UnauthorizedResponse",
      "ForbiddenResponse",
      "NotFoundResponse",
      "InternalServerErrorResponse"
    ]
  },
  "x-readme": {
    "explorer-enabled": false
  },
  "servers": [
    {
      "url": "{siteUrl}",
      "description": "Main endpoint."
    }
  ],
  "tags": 
    {
      "name": "Rule actions",
      "description": "When a rule containing a rule action is triggered, the [rules engine will make a request to the app to inform the app to run the configured rule action. The resulting status code will indicate to the rules engine whether the action was successfully completed and, if not, specify a cause for the error.\n\n_Note: An app server must be hosted in order for rule actions to function. For a brief list of popular hosting options, see [hosting](/docs/hosting)._"
    }
  ],
  "components": {
    "responses": {
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/UnauthorizedResponse"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Forbidden",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ForbiddenResponse"
            }
          }
        }
      },
      "NotFound": {
        "description": "Not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/NotFoundResponse"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Server error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/InternalServerErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "RootUIComponentRequest": {
        "description": "The building block of all app component requests.",
        "type": "object",
        "properties": {
          "expires_at": {
            "type": "string",
            "description": "The time (in ISO 8601 date format) when the request should expire.",
            "example": "2019-04-15T01:01:46.055Z"
          },
          "user": {
            "type": "string",
            "description": "The user GID this hook is coming from.",
            "example": "54321"
          },
          "workspace": {
            "type": "string",
            "description": "The workspace GID this hook is coming from.",
            "example": "12345"
          }
        }
      },
      "ForbiddenResponse": {
        "description": "An error response object indicating a forbidden request (i.e., a status code of `403`).",
        "type": "object",
        "properties": {
          "error": {
            "description": "The error to display.",
            "type": "string",
            "example": "Access forbidden."
          }
        }
      },
      "InternalServerErrorResponse": {
        "description": "An error response object indicating a request that could not be found (i.e., a status code of `500`).",
        "type": "object",
        "properties": {
          "error": {
            "description": "The error to display.",
            "type": "string",
            "example": "Internal server error."
          }
        }
      },
      "FormMetadataResponse": {
        "description": "Contains the metadata that describes how to display and manage a form.",
        "type": "object",
        "required": [
          "metadata",
          "template"
        ],
        "properties": {
          "template": {
            "description": "The interface name and version of a distinct form UI layout. A `template` is directly associated with a particular `metadata` schema.",
            "type": "string",
            "enum": [
              "form_metadata_v0"
            ],
            "example": "form_metadata_v0"
          },
          "metadata": {
            "description": "The metadata (i.e., underlying definition) of a form. `metadata` must exist alongside a `template`, and its schema must be specific to the value of that `template`.",
            "type": "object",
            "required": [
              "fields",
              "title"
            ],
            "properties": {
              "title": {
                "description": "The title of the form, which is displayed at the top of the creation form",
                "type": "string",
                "example": "Create New Issue"
              },
              "fields": {
                "description": "An array of form field objects that are rendered in the order they are in the array. Limit of 30 fields.\n\nValid object schemas: [FormField-Checkbox](/reference/app-components-forms/modal-forms#formfield-checkbox), [FormField-Date](/reference/app-components-forms/modal-forms#formfield-date), [FormField-Datetime](/reference/app-components-forms/modal-forms#formfield-datetime), [FormField-Dropdown](/reference/app-components-forms/modal-forms#formfield-dropdown), [FormField-MultiLineText](/reference/app-components-forms/modal-forms#formfield-multilinetext), [FormField-RadioButton](/reference/app-components-forms/modal-forms#formfield-radiobutton), [FormField-RichText](/reference/app-components-forms/modal-forms#formfield-richtext), [FormField-SingleLineText](/reference/app-components-forms/modal-forms#formfield-singlelinetext), [FormField-StaticText](/reference/app-components-forms/modal-forms#formfield-statictext), [FormField-Typeahead](/reference/app-components-forms/modal-forms#formfield-typeahead)",
                "type": "array"
              },
              "on_submit_callback": {
                "description": "The URL to `POST` the form to when the user clicks the submit button. If this is field is omitted then the submission button will be disabled. This is useful if the user must enter information in a watched field first, such as to show additional fields.",
                "type": "string",
                "example": "https://www.example.com/on_submit"
              },
              "on_change_callback": {
                "description": "The URL to `POST` the form to whenever watched field values are changed.",
                "type": "string",
                "example": "https://www.example.com/on_change"
              }
            }
          }
        }
      },
      "FormOnChangeFormSubmissionRequest": {
        "description": "Common properties between app component on change and on submit requests.",
        "properties": {
          "values": {
            "type": "object",
            "description": "An object that maps each FormField’s GID to its value.\nRefer to the `value` property on the FormField schema: [FormField-Checkbox](/reference/app-components-forms/modal-forms#formfield-checkbox), [FormField-Date](/reference/app-components-forms/modal-forms#formfield-date), [FormField-Datetime](/reference/app-components-forms/modal-forms#formfield-datetime), [FormField-Dropdown](/reference/app-components-forms/modal-forms#formfield-dropdown), [FormField-MultiLineText](/reference/app-components-forms/modal-forms#formfield-multilinetext), [FormField-RadioButton](/reference/app-components-forms/modal-forms#formfield-radiobutton), [FormField-RichText](/reference/app-components-forms/modal-forms#formfield-richtext), [FormField-SingleLineText](/reference/app-components-forms/modal-forms#formfield-singlelinetext), [FormField-StaticText](/reference/app-components-forms/modal-forms#formfield-statictext), [FormField-Typeahead](/reference/app-components-forms/modal-forms#formfield-typeahead)",
            "example": {
              "checkbox_field_1": [
                "opt-in"
              ],
              "date_field_1": "2021-12-31T08:00:00.000Z",
              "datetime_field_1": "2023-01-01T00:00:00.000Z",
              "dropdown_field_1": "red",
              "multi_line_text_field_1": "Multiline Text",
              "radio_button_field_1": "blue",
              "rich_text_field_1": "<BODY>Rich Text</BODY>",
              "single_line_text_field_1": "Single Line Text",
              "static_text_field_1": "Static Text",
              "typeahead_field_1": {
                "icon_url": "https://example.com/icon.png",
                "subtitle": "Subtitle",
                "title": "Title",
                "value": "Typeahead"
              }
            }
          }
        }
      },
      "FormOnChangeBaseRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RootUIComponentRequest"
          },
          {
            "$ref": "#/components/schemas/FormOnChangeFormSubmissionRequest"
          },
          {
            "type": "object",
            "description": "The body of an onchange event.",
            "properties": {
              "changed_field": {
                "type": "string",
                "description": "The name of the changed FormField.",
                "example": "checkbox_field_1"
              }
            }
          }
        ]
      },
      "ActionFormOnChangeRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/FormOnChangeBaseRequest"
          },
          {
            "type": "object",
            "description": "The body of an action onchange event.",
            "properties": {
              "action": {
                "type": "string",
                "description": "The ID of an existing rule action that is being edited.",
                "example": "12345"
              },
              "action_type": {
                "type": "string",
                "description": "The ID of the configuration used to create the rule action.",
                "example": "45678"
              },
              "project": {
                "type": "string",
                "description": "The project GID this hook is coming from.",
                "example": "12345"
              }
            }
          }
        ]
      },
      "NotFoundResponse": {
        "description": "An error response object indicating a request that could not be found (i.e., a status code of `404`).",
        "type": "object",
        "properties": {
          "error": {
            "description": "The error to display.",
            "type": "string",
            "example": "Not found."
          }
        }
      },
      "UnauthorizedResponse": {
        "description": "An error response object indicating a unauthorized request (i.e., a status code of `401`).",
        "type": "object",
        "properties": {
          "error": {
            "description": "The error to display.",
            "type": "string",
            "example": "Authorization required."
          }
        }
      }
    }
  },
  "paths": {
    "/action.on_change_callback_path_placeholder": {
      "post": {
        "summary": "On action change callback",
        "description": "_Note: The path is a placeholder. The actual path is determined by the configuration of the app component._\n\nThe callback request made to an app server when a watched field's value changes within an action form. The request is subject to a 10-second timeout if no response is received from the app server. <br> <br> <a href=\"https://d3ki9tyy5l5ruj.cloudfront.net/obj/e17aad6e1b091b6fa410679d417d4c48643339ea/ac-rule-on-change.png\">\n  \n</a>",
        "tags": [
          "Rule actions"
        ],
        "operationId": "onActionFormChange",
        "requestBody": {
          "description": "Request to notify of an on change event.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActionFormOnChangeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successfully returned the new state of the form.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormMetadataResponse"
                }
              }
            }
          },
          "400": {
            "description": "Something was wrong with the form data.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormMetadataResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  }
}