I'm trying to create automation rules in Confluence Cloud programmatically using the REST API, but I'm getting 404 errors on all automation endpoints.
What I'm trying to do:
Endpoints I've tried:
https://[site].atlassian.net/wiki/rest/api/automation/rule
→ 404https://[site].atlassian.net/wiki/rest/api/automation
→ 404https://[site].atlassian.net/rest/api/automation/rule
→ 404What works:
/rest/api/space
) work fine with my credentialsQuestions:
Hi @Ganesh Naiknavare and welcome,
please take a look to the following documentation https://developer.atlassian.com/cloud/automation/rest/intro/#about in order to retrieve information about what type of operation you can perform on automation through rest api.
Hope this clarifies,
Fabio
Send an email when a Confluence page is updated.
Please check my code and give me suggestion based on this
import requests
import json
# Configuration variables
USER_EMAIL = "" # Email address to receive notifications
CLOUD_ID = "" # Your Confluence cloud ID
API_TOKEN = "" # Atlassian API token
SPACE_KEY = "" # Optional: only needed if you plan to filter by space
EMAIL = "" # Not used in the script – can be removed
# Confluence Automation API endpoint
url = f"https://api.atlassian.com/automation/public/confluence/{CLOUD_ID}/rest/v1/rule"
# HTTP headers
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {API_TOKEN}"
}
# Automation rule payload
payload = {
"rule": {
"name": "Page Updated Email Notification",
"description": "Send email when page is updated",
"state": "ENABLED",
"trigger": {
"component": "TRIGGER",
"type": "confluence.page.updated",
"schemaVersion": 1,
"value": {}
},
"components": [
{
"component": "ACTION",
"type": "confluence.send.email",
"schemaVersion": 1,
"value": {
"to": {
"type": "static",
"value": USER_EMAIL
},
"subject": {
"type": "smart",
"value": "Page Updated: {{page.title}}"
},
"body": {
"type": "smart",
"value": (
"Page '{{page.title}}' in space '{{page.space.name}}' "
"was updated by {{user.displayName}} at {{now}}.\n\n"
"View page: {{page.url}}"
)
}
}
}
]
}
}
# Send POST request to create automation rule
response = requests.post(url, headers=headers, json=payload)
# Print response
print(f"Status: {response.status_code}")
print(f"Response: {response.text}")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.