Recent searches


No recent searches

API data about un-created organizations

Answered


Posted Jan 29, 2024

In the agent workspace, there are frequently suggested organizations for agents to create, where it will say "NewOrganization (Create)" for emails with the domain neworganization.com, if there's no existing organization using that domain.

Is there a way to query domains from end users that have not had an organization created? In the example above, can I query an organization end point for domains without an associated organization?

The only way I can think of is to query end user aliases, extract the domain, query  organizations and list the domains without an associated organizations. This is a somewhat inefficient, upside down query, and I'm curious whether there is a data point to use to find these.


0

1

1 comment

image avatar

Brandon Tidd

Zendesk LuminaryUser Group LeaderThe Humblident Award - 2021Community Moderator

Hey mfg

In Zendesk, querying domains from end-users that have not had an organization created is indeed a bit complex, as there's no direct endpoint or feature in the Zendesk API that provides a list of these domains directly. Your approach of querying end-user aliases, extracting domains, and then comparing them with existing organizations is one way to do it, albeit not the most efficient.

Here's a more streamlined approach to achieve this:

1. **Extract Domains from User Emails:**
   - Use the Zendesk API to list users (`/api/v2/users.json`).
   - Extract the domain part of their email addresses.

2. **Get Existing Organization Domains:**
   - Use the Zendesk API to list organizations (`/api/v2/organizations.json`).
   - Extract the domain names associated with these organizations.

3. **Compare and Identify Unassociated Domains:**
   - Compare the list of user email domains with the organization domains.
   - Identify domains that are present in the user list but not in the organization list.

This process can be automated using a script. Here’s a basic outline in pseudocode:

```pseudocode


user_domains = set()
org_domains = set()

# Get all users
users = GET /api/v2/users.json
for user in users:
    domain = extract_domain(user.email)
    user_domains.add(domain)

# Get all organizations
orgs = GET /api/v2/organizations.json
for org in orgs:
    domain = extract_domain_from_org(org)  # Assuming organizations have domain info
    org_domains.add(domain)

# Find unassociated domains
unassociated_domains = user_domains - org_domains
```

Note:
- **Pagination**: Both user and organization endpoints are paginated, so ensure your script handles this.
- **Rate Limits**: Be mindful of Zendesk's API rate limits.
- **Domain Extraction Logic**: You'll need to write logic to extract domain names from email addresses and organization information.

This method is more efficient than querying each user and organization repeatedly. It focuses on gathering all necessary data first and then processing it, which is generally faster and puts less load on the API.

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post