How to create a page and add the task tagging a user using Confluence CLI

This article explains how to create tasks and assign them to a user by adding @mention using Confluence CLI. With this article, you can see the status (Complete or Incomplete) of user tasks. CLI action command lets you provide the task description and user name in the task list item, to assign the user as Assignee to the task.

Instructions

Use the addPage action to add a new page and provide the user name to whom you want to assign a task.

  1. Log in to Confluence. 
  2. If the user already exists, then go to step 3. If the user does not exist, create a new user, for example, automation.
  3. Add the user with @mention on a sample page, Example-task.
  4. Go to the user's profile page and copy the user id from the URL as shown below:


  5. Use the userkey details as shown in the CLI action below and run the action:

    --action addPage --space TAS --title "Example-task" --content "<p>This is a new page</p><ac:task-list><ac:task><ac:task-id>3</ac:task-id><ac:task-status>incomplete</ac:task-status><ac:task-body><ac:link><ri:user ri:userkey="2c9180836d163e1d016d163fe09a0000" /></ac:link> take up this task list item-1</ac:task-body></ac:task> <ac:task><ac:task-id>5</ac:task-id><ac:task-status>complete</ac:task-status><ac:task-body><ac:link><ri:user ri:userkey="2c9180836d163e1d016d163fe09a0000" /></ac:link>, you can also do this task</ac:task-body></ac:task><ac:task><ac:task-id>6</ac:task-id><ac:task-status>complete</ac:task-status><ac:task-body><ac:link><ri:user ri:userkey="4028d083739f35770173b3d1a0220003" /></ac:link>do this now</ac:task-body></ac:task></ac:task-list>"  --markdown --replace
    In the Confluence page, Example-task, you can see the tasks with @mentioned user as shown below:

  6. Once the user logs in to confluence, one can navigate to the user profile, and view the Complete and Incomplete tasks as shown below:

The following parameters are used in the mentioned CLI action. 

--space: Space key of the space.

--title: Title of the page.

--content: Content for a page.

--markdown: It converts rendered Markdown content to storage format.

--replace: Replace existing entity on add, create, or similar actions.