type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Show Identity
* Shows the identity with the given id for a given user.
Use the first endpoint if authenticating as an agent. Use the second if authenticating as an end user. End users can only view email or phone number identity.
#### Allowed For
* Agents
* Verified end users
*/
export async function main(
auth: Zendesk,
user_id: string,
user_identity_id: string
) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/users/${user_id}/identities/${user_identity_id}`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 377 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Show Identity
* Shows the identity with the given id for a given user.
Use the first endpoint if authenticating as an agent. Use the second if authenticating as an end user. End users can only view email or phone number identity.
#### Allowed For
* Agents
* Verified end users
*/
export async function main(
auth: Zendesk,
user_id: string,
user_identity_id: string
) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/users/${user_id}/identities/${user_identity_id}`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 923 days ago