# Actions

Actions are the functionality that your app provides. Actions can be defined as the standalone plugins that can perform a specific function in you app. Actions can be defined in your [App Schema](/docs/chatlayer/app-schema) on the actions property. It takes in [Actions Schema](/docs/chatlayer/app-schema/actions-schema) which defines everything about each action. The actions defined here will show up in the [Chatlayer Action Dialogs](https://docs.chatlayer.ai/bot-answers/dialog-state/action-bot-dialog).

```javascript
module.exports = {
    create_contact: {
        id: "create_contact",
        display: {
            label: "Create Contact",
            description: "Allows you to create a User/Customer on Freshdesk",
        },
        fields: [
            {
                key: "name",
                label: "Name",
                helpText: "The contact full name",
                required: true,
            },
            {
                key: "email",
                label: "Email",
                helpText: "The contact email address",
                required: true,
            },
            {
                key: "phone",
                label: "Phone",
                helpText: "The contact phone number",
            },
            {
                key: "job_title",
                label: "Title",
            },
            {
                key: "address",
                label: "Address",
            },
            {
                key: "description",
                label: "Description",
                type: "text",
            },
        ],
        operation: {
            perform: async (sdk, bundle) => {
                let {name, email, phone, job_title, address, description} =
                    bundle.inputData;
                return sdk
                    .request({
                        method: "POST",
                        url: `https://${bundle.authData.domain}.freshdesk.com/api/v2/contacts`,
                        body: {
                            name,
                            email,
                            phone,
                            job_title,
                            address,
                            description,
                        },
                    })
                    .then((res) => {
                        if (res.status === 201) {
                            return res.data;
                        }
                        throw new Error("Some thing went wrong");
                    });
            },
        },
    }
}
```

```javascript
const actions = require("./src/actions");

module.exports = {
    ...,
    actions: {...actions},
    ...,
};
```

The code above shows following UI

![add_action_page.png](/assets/add_action_page.d6a8363398bfc24c3efd8fe67274b89196d82c7d0ede3079106123337aa7304f.5e150121.png)

![setup_action_page.png](/assets/setup_action_page.4230bba20b4e1e722fce38d0e241297b46e610cc612b3f4b5d026c3dc23308e7.5e150121.png)