---
title: "I want to automatically comment when closing a live chat"
canonical: "https://support.appfire.com/space/CHAT/2158690627/I%20want%20to%20automatically%20comment%20when%20closing%20a%20live%20chat"
format: markdown
---
> Macro (aura-html)

When a live chat request (via Chat for JSM) is closed, a custom comment should be automatically added to the request to notify the customer. The comment includes a message confirming the request has been resolved and provides a link to the full ticket details in the support portal.

This can be implemented using the JMWE **Comment issue(s)** post-function on the resolution transition of your Jira Service Management project.

## Prerequisites

Make sure the following are in place:

- You are using Jira Cloud.
- Both Chat for JSM and JMWE for Jira Cloud apps are installed.
- You have a Jira Service Management project with a live chat workflow.
- You have a transition that moves chat requests to a resolved state (for example, from "In Progress" or "Waiting for Support" to "Done" or "Resolved").

> ℹ️ If you want to use JMWE to send automated messages after a chat closes, remember to disable the default system message in Chat settings to avoid sending customers two similar messages.
> ℹ️ 
> ℹ️ Go to **Project Settings** > **Chat for JSM** > **Features** > **Resolved Work Items**, and check:
> ℹ️ 
> ℹ️ - Disable adding messages to work items with Resolved status
> ℹ️ - Disable a default message generated after a work item is closed
> ℹ️ 
> ℹ️ This ensures a smooth experience where only your custom JMWE message reaches the customer.

## Configuration steps

1. Edit the target workflow:
  - Navigate to the Jira project settings.
  - Open the workflow associated with the work type (for example, "Chat Request").
  - Select the transition that marks the request as "Done" (e.g., "Resolve this issue").
2. Add the **Comment Issue(s)** post-function:
  - Click **Post Functions** and select **Add post function**.
  - Choose **Comment issue(s)** from JMWE.
  - In the **Comment text **section, enter the following Nunjucks template:
    👉 Replace the URL prefix with your actual Service Desk portal link (this example uses `portal/2`).
3. Configure the scope and options:
  - Ensure the comment is added to the current issue.
  - Set the post-function to run as the current user (or app user if appropriate).
  - Optionally restrict execution using a condition if needed.
4. Save and publish the workflow.

## Result

Once the ticket is resolved, JMWE automatically adds a comment that includes the ticket link, as illustrated in the chat conversation below.

![Chat for Jira Service Management Cloud comment automation conditions](media://d7891dfa-41a3-46e0-b240-22aa2917f27c)