Script Listeners
Listeners automate procedures and functions when specific events occur in Confluence Cloud.
A listener is an automated procedure or function in ScriptRunner that waits (or listens) for a specific event (or web hook) to occur in Confluence Cloud. Events are fired after an action takes place, for example, when a blog is created or a space is removed. Just after the event occurs, the listener takes action based on your requirements.
For a listener to work, two things have to be defined:
The event (webhook) the listener waits for
Note: Examples of events are when a page is created, a comment is added, or a new user is created.The action the listener takes
Additionally, you can choose which user the listener run as. You can also specify which space(s) the listener applies to. By default, listeners run for all spaces.
Use cases
Listeners are very flexible. In a standard work environment, there are plenty of times when a routine task needs to be accomplished but is time-consuming do manually. Listeners ensure that you can implement your business's processes concisely.
Example listeners include:
- Create a Jira ticket when a page is created in a certain space for work tracking purposes
- Set a watcher for new blog posts
- Watch for frequently made mistakes and automatically flags them with an inline comment (helpful for a content editor)
- Create a Jira project whenever a Confluence space is created
- Watch a specific user's content in a space
- Create a templated 'about user' page when a new user is created
- Automatically add a label to a new page to notify users that it requires review.
Use Listeners
Script examples
ScriptRunner has a number of Example Scripts for you to use. To access them, select Example scripts in the Script field:
Preview of included Script Listener examples:
- Create a page hierarchy with templates
- Create a page hierarchy with templates can be used to create a similar page setup multiple times with a template. It is useful because it saves you time when setting up new Confluence Cloud pages.
- Create Jira Tickets When a Page Is Created in Confluence
- Create Jira Tickets When a Page is Created in Confluence can be used to onboard someone, like a to-do list or to automatically track work in Jira. It's useful because it reduces time spent on creating the Jira tickets, and it establishes and enforces business processes.
- Set a Watcher For New Blog Posts
- Set a Watcher For New Blog Posts automatically sets a watcher for new blog posts. It is useful because it allows a user to be always following new blog posts from a certain user.
- Company Language Checker
- Company Language Checker checks if a forbidden/incorrect word is used on a page and adds a comment if it is. For example, it could catch JIRA because it should be Jira. It is useful because instead of checking manually for words, a user can automate this and ensure that mistakes aren't made.