I have 550 Saved Reply (Messaging) Agent Assets and 450 Saved Reply (Email) Agent Assets.
When calling the APIs to list the assets, (GET /contact_center/asset_library/assets) I am not getting any of the email. All of the messaging Saved Replies have an asset type of saved_reply.
How do I get the API to return the Saved Reply (Email) Agent Assets?
Hi @NateCCIE , are you using the query parameter asset_type: saved_reply in the initial request?
Can you also try getting an individual email agent asset with the endpoint get/contact_center/asset_library/assets/{assetId} by querying with one of the individual assetId to confirm it exists?
1 Like
No filtering at all on the /v2/contact_center/asset_library/assets call, just getting everything with paging and then checking if the asset_type is savedReply, and loggging if I see anything else. I get all of the system assets, and all of the messaging assets (saved reply) but none of the email saved replies.
PAGE_SIZE = 50
OUTPUT_CSV = "agent_saved_replies.csv"
# -----------------------------
def get_access_token():
"""Obtain Server-to-Server OAuth token."""
url = "token"
params = {
"grant_type": "account_credentials",
"account_id": ACCOUNT_ID
}
resp = requests.post(url, params=params, auth=(CLIENT_ID, CLIENT_SECRET))
if resp.status_code != 200:
print("ā Failed to get access token:", resp.text)
sys.exit(1)
return resp.json()["access_token"]
def zoom_get(url, token, params=None):
"""Helper for authenticated GET requests."""
headers = {"Authorization": f"Bearer {token}"}
r = requests.get(url, headers=headers, params=params)
r.raise_for_status()
return r.json()
def get_asset_content(token, asset_id):
"""Fetch full content for a single asset (asset_items will contain all languages)."""
url = f"{BASE_URL}/{asset_id}"
headers = {"Authorization": f"Bearer {token}"}
r = requests.get(url, headers=headers)
r.raise_for_status()
return r.json()
def main():
token = get_access_token()
next_page = ""
all_agent_assets = []
print("š Fetching list of agent assets (savedReply)...")
while True:
params = {"page_size": PAGE_SIZE}
if next_page:
params["next_page_token"] = next_page
data = zoom_get(BASE_URL, token, params)
assets = data.get("assets", [])
# Filter for savedReply and log skipped assets
agent_assets = []
for a in assets:
asset_type = a.get("asset_type")
if asset_type == "savedReply":
agent_assets.append(a)
else:
print(f"Skipping asset '{a.get('asset_name')}' with type '{asset_type}'")
all_agent_assets.extend(agent_assets)
next_page = data.get("next_page_token")
if not next_page:
break
print(f"\nā
Total savedReply assets fetched: {len(all_agent_assets)}")
print(f"Fetching full content and writing to CSV: {OUTPUT_CSV}")
# Open CSV for writing
with open(OUTPUT_CSV, mode="w", newline="", encoding="utf-8") as csvfile:
writer = csv.DictWriter(
csvfile,
fieldnames=["Asset ID", "Name", "Type", "Language", "Category", "Last Modified", "Content"]
)
writer.writeheader()
for index, asset in enumerate(all_agent_assets, 1):
asset_id = asset.get("asset_id")
asset_name = asset.get("asset_name")
try:
content_data = get_asset_content(token, asset_id)
asset_items = content_data.get("asset_items", [])
if not asset_items:
# Write a row even if no content
writer.writerow({
"Asset ID": asset_id,
"Name": asset_name,
"Type": asset.get("asset_type"),
"Language": "",
"Category": asset.get("category_name"),
"Last Modified": asset.get("last_modified_time"),
"Content": ""
})
# Loop over all languages for this asset
for item in asset_items:
content_text = item.get("asset_item_content", "")
language = item.get("asset_item_language", "")
writer.writerow({
"Asset ID": asset_id,
"Name": asset_name,
"Type": asset.get("asset_type"),
"Language": language,
"Category": asset.get("category_name"),
"Last Modified": asset.get("last_modified_time"),
"Content": content_text
})
except Exception as e:
print(f"ā Failed to fetch content for {asset_name} ({asset_id}): {e}")
print(f"{index}/{len(all_agent_assets)} processed -> {asset_name}")
print(f"\nā
Export complete. CSV saved as: {OUTPUT_CSV}")
if __name__ == "__main__":
main()