Multi-Actions

To support multiple actions, Action provider GET responses may include additional action URLs via the links attribute. Here's an example of what that might look like:

And here's the code supporting these use cases:


export interface LinkedAction {
  /** URL endpoint for an action */
  href: string;
  /** button text rendered to the user */
  label: string;
  /** Parameter to accept user input within an action */
  parameters?: [ActionParameter];
}

/** Parameter to accept user input within an action */
export interface ActionParameter {
  /** parameter name in url */
  name: string;
  /** placeholder text for the user input field */
  label?: string;
  /** declare if this field is required (defaults to `false`) */
  required?: boolean;
}

Although linked Actions are valid, they only provide a label and href as they are are intended to be used to display additional buttons in a single Blink. This interface affords you several options:

Consult those links for much more information, including code snippets you can lift for your own project. We also cover some of this in the next section.

A few other things to keep in mind:

  • Linked actions hrefs support both absolute and relative paths.

  • The optional parameters attribute allows for a second action type, which is covered in the next section.

  • Linked actions are themselves Action URLs at href, and may themselves also return multiple actions.

Continue on the next section to read more about Action Types.

Last updated