Send email to people who I have shared the App with

I made some changes to an App, I want to send email about those changes to people whom I have shared the App with.
I haven't used workflow before and it seems very confusing. So I couple of question:
How do I get a list of people whom I've shared the App with?
Best Answer
-
Hey @verytiredgirl!
As @ColemenWilson mentioned, I was able to write some Python code that pulls the data you are looking for and pushes it to a Domo dataset for use within a workflow (and anywhere else you'd like it). I have this configured to work within a Jupyter Workspace within our Domo instance. Here's the code I have:
import requests
import json
import pandas as pd
import numpy as np
import domojupyter as domo # You'll need to create a dev token, store it in an Account, and then add that Account to this Jupyter Workspace, naming it "Domo Dev Token" account_properties = domo.get_account_property_keys('Domo Dev Token')
devToken = domo.get_account_property_value('Domo Dev Token', account_properties[0]) def app_user_access(app_id):
"""Retrieves user access data related to a particular App Studio app Args:
app_id (str): The id of the app to get a user access list from
Returns:
df_combined (Pandas dataframe): A dataframe of all users (and groups with users) that have access to an app
"""
# You'll
baseURL = "https://[your-instance-name].domo.com/api/content/v1/dataapps/" + str(app_id) + "/adminsummary"
headers = {
"x-domo-developer-token": devToken,
"accept": "application/json"
}
response = requests.request("GET", baseURL, headers=headers)
# Pull direct access list
users = json.loads(response.text)['access']['users']
user_df = pd.json_normalize(users)[['id', 'displayName', 'emailAddress', 'title']]
user_df.rename(columns={'id': 'User ID', 'displayName': 'Display Name', 'title': 'User Title', 'emailAddress': 'Email'}, inplace=True)
# Pull users with access via a group
if 'groups' in json.loads(response.text)['access']:
groups = json.loads(response.text)['access']['groups']
group_users_df = pd.json_normalize(groups, 'userIds', ['id', 'name'], record_prefix="userID")
group_users_df.rename(columns={'userID0': 'User ID', 'id': 'Group ID', 'name': 'Group Name'}, inplace=True)
# Join in user data # This is just the "People" Domo Governance dataset
user_data = domo.read_dataframe('Domo Governance People dataset', query='SELECT * FROM table')
user_data['User ID'] = user_data['User ID'].astype('int64')
group_users_df = group_users_df.merge(user_data[['User ID', 'Display Name', 'Title', 'Email']], on='User ID', how='left')
group_users_df.rename(columns={'Title': 'User Title'}, inplace=True)
df_combined = pd.concat([user_df, group_users_df], ignore_index=True, sort=False)
else:
df_combined = user_df
df_combined['App ID'] = app_id
return df_combined def all_app_user_access():
"""Retrieves user access data related to all App Studio apps
Returns:
all_app_access_df (Pandas dataframe): A dataframe of all users (and groups with users) that have access to all apps in Domo
"""
# Get a list of all app ids # NOTE: This dataflow was custom made, so you'll need to create it and add it to the Jupyter Workspace
pages_df = domo.read_dataframe('Apps and Pages Dataset', query='SELECT * FROM table')
apps_df = pages_df[pages_df['Is an App'] == 1]
apps_df = apps_df[['App ID', 'App Name']].drop_duplicates()
list_of_app_ids = apps_df['App ID'].tolist()
list_of_app_names = apps_df['App Name'].tolist()
# Loop through all apps
all_app_access_df = pd.DataFrame()
for i in range(0,len(list_of_app_ids)):
app_data = app_user_access(list_of_app_ids[i])
app_data['App Name'] = list_of_app_names[i]
all_app_access_df = pd.concat([all_app_access_df, app_data], ignore_index=True, sort=False)
return all_app_access_df domo.write_dataframe(all_app_user_access(), 'Apps with Users Dataset')However, this code only works if you create a dataset called "Apps and Pages Dataset" via a dataflow that looks like this:
I'm basically just getting a list of all Apps and their associated pages, with owner info as well.
Kinda complicated, but it works for us, so I hope this helps!1
Answers
-
If this is something you just want to do once, you're better off just looking at the list of people you've shared the app with (look at the card or look at the asset in the asset library) and writing them an email.
Workflows are best for processes that you want to perform frequently, and want to automate those processes. If this is something you want to do EVERY TIME you make changes to an app, and you're doing that with some frequency, a Workflow could be a good candidate.
Workflows are, in my opinion, the most powerful tool in Domo. This use case aside, you should learn how to use them. I'd suggest going to learndomo.domo.com and taking the "Getting Started with Workflows" training. It will take about 2 hours, but it's cut up in to lots of chunks so you can do it over time.
0 -
@DanHendriksen Yes it is something that I do frequently hence I'd like to use workflow for this (as it can be applied to other App as well). I do know it is a powerful tool, I did watch a couple of tutorials on workflow and get a general idea but I have yet to see one where you can use work flow, find a list of people to send email to. Which is why I asked on Domo Community to see if it's something I can achieve with workflow.
0 -
Apps and Users is not currently an available Domostats or Domo Governance report. @nathankilcrease on my team was able to build a custom report to pull all users that apps are shared with, which allows me to get a list of emails to copy and paste and do exactly what you are trying to do.
@nathankilcrease could you share how you did this with @verytiredgirl?
If I solved your problem, please select "yes" above
0 -
In the training, one of the examples you will create involves sending an email to people. You don't need to take the training if you don't want to, but in the hundreds of customers I've worked with on Workflows it's been unanimously good feedback that it has helped shorten the learning curve.
It sounds like Coleman has some work he can share to help you get a list of emails. You can pass that list of emails to the Send Email function in the emailAddresses input parameter.
You'll then want to create a customized start form that allows you to write the message you want to send when you make a change, and hit that button to find the list of users and send it.0 -
Hey @verytiredgirl!
As @ColemenWilson mentioned, I was able to write some Python code that pulls the data you are looking for and pushes it to a Domo dataset for use within a workflow (and anywhere else you'd like it). I have this configured to work within a Jupyter Workspace within our Domo instance. Here's the code I have:
import requests
import json
import pandas as pd
import numpy as np
import domojupyter as domo # You'll need to create a dev token, store it in an Account, and then add that Account to this Jupyter Workspace, naming it "Domo Dev Token" account_properties = domo.get_account_property_keys('Domo Dev Token')
devToken = domo.get_account_property_value('Domo Dev Token', account_properties[0]) def app_user_access(app_id):
"""Retrieves user access data related to a particular App Studio app Args:
app_id (str): The id of the app to get a user access list from
Returns:
df_combined (Pandas dataframe): A dataframe of all users (and groups with users) that have access to an app
"""
# You'll
baseURL = "https://[your-instance-name].domo.com/api/content/v1/dataapps/" + str(app_id) + "/adminsummary"
headers = {
"x-domo-developer-token": devToken,
"accept": "application/json"
}
response = requests.request("GET", baseURL, headers=headers)
# Pull direct access list
users = json.loads(response.text)['access']['users']
user_df = pd.json_normalize(users)[['id', 'displayName', 'emailAddress', 'title']]
user_df.rename(columns={'id': 'User ID', 'displayName': 'Display Name', 'title': 'User Title', 'emailAddress': 'Email'}, inplace=True)
# Pull users with access via a group
if 'groups' in json.loads(response.text)['access']:
groups = json.loads(response.text)['access']['groups']
group_users_df = pd.json_normalize(groups, 'userIds', ['id', 'name'], record_prefix="userID")
group_users_df.rename(columns={'userID0': 'User ID', 'id': 'Group ID', 'name': 'Group Name'}, inplace=True)
# Join in user data # This is just the "People" Domo Governance dataset
user_data = domo.read_dataframe('Domo Governance People dataset', query='SELECT * FROM table')
user_data['User ID'] = user_data['User ID'].astype('int64')
group_users_df = group_users_df.merge(user_data[['User ID', 'Display Name', 'Title', 'Email']], on='User ID', how='left')
group_users_df.rename(columns={'Title': 'User Title'}, inplace=True)
df_combined = pd.concat([user_df, group_users_df], ignore_index=True, sort=False)
else:
df_combined = user_df
df_combined['App ID'] = app_id
return df_combined def all_app_user_access():
"""Retrieves user access data related to all App Studio apps
Returns:
all_app_access_df (Pandas dataframe): A dataframe of all users (and groups with users) that have access to all apps in Domo
"""
# Get a list of all app ids # NOTE: This dataflow was custom made, so you'll need to create it and add it to the Jupyter Workspace
pages_df = domo.read_dataframe('Apps and Pages Dataset', query='SELECT * FROM table')
apps_df = pages_df[pages_df['Is an App'] == 1]
apps_df = apps_df[['App ID', 'App Name']].drop_duplicates()
list_of_app_ids = apps_df['App ID'].tolist()
list_of_app_names = apps_df['App Name'].tolist()
# Loop through all apps
all_app_access_df = pd.DataFrame()
for i in range(0,len(list_of_app_ids)):
app_data = app_user_access(list_of_app_ids[i])
app_data['App Name'] = list_of_app_names[i]
all_app_access_df = pd.concat([all_app_access_df, app_data], ignore_index=True, sort=False)
return all_app_access_df domo.write_dataframe(all_app_user_access(), 'Apps with Users Dataset')However, this code only works if you create a dataset called "Apps and Pages Dataset" via a dataflow that looks like this:
I'm basically just getting a list of all Apps and their associated pages, with owner info as well.
Kinda complicated, but it works for us, so I hope this helps!1
Categories
- All Categories
- Product Ideas
- 2.1K Ideas Exchange
- Connect
- 1.3K Connectors
- 309 Workbench
- 7 Cloud Amplifier
- 10 Federated
- Transform
- 664 Datasets
- 120 SQL DataFlows
- 2.3K Magic ETL
- 824 Beast Mode
- Visualize
- 2.6K Charting
- 87 App Studio
- 46 Variables
- Automate
- 195 Apps
- 486 APIs & Domo Developer
- 90 Workflows
- 24 Code Engine
- AI and Machine Learning
- 23 AI Chat
- 4 AI Projects and Models
- 18 Jupyter Workspaces
- Distribute
- 119 Domo Everywhere
- 283 Scheduled Reports
- 11 Software Integrations
- Manage
- 143 Governance & Security
- 11 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 116 Community Announcements
- 5K Archive