# Actions schema The Actions schema is the one which takes in a JSON string and adds dynamic UI on the [Chatlayer Action Dialogs](https://docs.chatlayer.ai/bot-answers/dialog-state/action-bot-dialog). These are also known as functional plugins or Data integrations. Each key in the schema is considered as a plugin in action dialog. And the value of that key will determine what UI components to show as well as what operation to do in there. The type of Action Schema can be defined as ```typescript interface Actions { [key: string]: ActionSchemaValue } ``` The ActionSchemaValue is a JSON object with following properties ## Properties | Property | Description | Value Type | | --- | --- | --- | | id | The unique identifier of the plugin | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | | display | The value to be used to describe what the plugin does | [ActionSchemaValueDisplay](/docs/chatlayer/app-schema/actions-schema#actionschemavaluedisplay) | | operation | The operation to do when the user executes this plugin. It is a json schema which defines what action to perform. | [OperationSchema](/docs/chatlayer/app-schema/actions-schema#operationschema) | | fields | The fields to show on the UI for user input. Can be considered as a form where the user can submit their data. | Array of [Fields schema](/Read about the fields schema.) | ### ActionSchemaValueDisplay ActionSchemaValueDisplay is a JSON object with following properties. | Property | Description | Value Type | | --- | --- | --- | | label | The label to show as the name of the plugin. | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | | description | The description text to be shown to explain about the plugin | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | ### OperationSchema This schema tells the App Integration framework what to do when the user executes this plugin. So this schema can be considered as the core of the action plugin. It describes the function that needs to run when this action plugin is executed. It has the following schema | Property | Description | Value Type | | --- | --- | --- | | perform | The function to be executed when the user executes this action plugin. It takes in [SDK object](/docs/chatlayer/actions/sdk-object) and [bundle object](/docs/chatlayer/actions/bundle-object) as arguments. | [function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions) | ## Example ```javascript { reply_ticket: { id: "reply_ticket", display: { label: "Add replies to a ticket", description: "Add replies to the ticket which sends an email to the ticket creator", }, operation: { perform: async (sdk, bundle) => { let { ticket_no, body } = bundle.inputData; return sdk .request({ method: "POST", url: `https://${bundle.authData.domain}.freshdesk.com/api/v2/tickets/${ticket_no}/reply`, body: { body, }, }) .then((res) => { if (res.status === 201) { return res.data; } throw new Error("Some thing went wrong"); }); }, }, fields: [ { key: "ticket_no", label: "Ticket No", helpText: "Ticket Number ( Display ID) to which the reply has to be added.", required: true, }, { key: "body", label: "Reply", type: "text", helpText: "The reply that needs to be added to the ticket.", required: true, }, ], }, } ``` ```javascript const actions = require("./src/actions"); module.exports = { ... actions: actions, ... }; ```