Since the migration of Opsgenie to Jira we have trouble with functionality, mainly the unavailability to see/check from UI if the user have their phone number added to profile. It's crucial for the Alerting/Paging functionality.
Anyone have idea on how to solve this mistery?
To address the issue of checking if users have their phone numbers added to their profiles in Jira Cloud (post-migration from Opsgenie), we can leverage the Jira Cloud REST API. Unfortunately, Jira's UI might not provide a direct way to view user profile details such as phone numbers, but the API can be a powerful tool for retrieving this information.
Here’s a detailed guide on how to check users’ phone numbers using the Jira Cloud REST API:
Ensure you have the necessary permissions to access the Jira Cloud REST API. You will need an API token for authentication. You can generate an API token from your Atlassian account:
You can use Python to write a script that fetches user details, including their phone numbers. Here is an example script:
import requests
from requests.auth import HTTPBasicAuth
import json
# Your Jira Cloud instance details
JIRA_URL = "https://your-domain.atlassian.net"
API_TOKEN = "your_api_token"
EMAIL = "your_email@example.com"
# Function to fetch user details
def get_user_details(username):
url = f"{JIRA_URL}/rest/api/3/user?username={username}"
auth = HTTPBasicAuth(EMAIL, API_TOKEN)
headers = {
"Accept": "application/json"
}
response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)
return json.loads(response.text)
# Function to check if a user has a phone number
def check_phone_number(username):
user_details = get_user_details(username)
if 'phone' in user_details:
return user_details['phone']
else:
return "No phone number added"
# List of usernames to check
usernames = ["user1", "user2", "user3"]
# Check phone numbers for each user
for username in usernames:
phone_number = check_phone_number(username)
print(f"Username: {username}, Phone Number: {phone_number}")
Save the script and run it in your Python environment. The script will output the phone number for each user if available, or indicate that no phone number is added.
Automating the Process
To automate this process, you can set up a cron job (on Unix-based systems) or a Task Scheduler (on Windows) to run the script at regular intervals.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.