type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Open a User's Profile in an Agent's Browser
* Allows you to instruct an agent's browser to open a user's profile.
When the message is successfully delivered to an agent's browser:
```http
Status: 200 OK
```
When `agent_id` or `user_id` is invalid:
```http
Status: 404 Not Found
```
#### Allowed For
* Agents
*/
export async function main(auth: Zendesk, agent_id: string, user_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/channels/voice/agents/${agent_id}/users/${user_id}/display`
);
const response = await fetch(url, {
method: "POST",
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.text();
}
Submitted by hugo697 298 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Open a User's Profile in an Agent's Browser
* Allows you to instruct an agent's browser to open a user's profile.
When the message is successfully delivered to an agent's browser:
```http
Status: 200 OK
```
When `agent_id` or `user_id` is invalid:
```http
Status: 404 Not Found
```
#### Allowed For
* Agents
*/
export async function main(auth: Zendesk, agent_id: string, user_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/channels/voice/agents/${agent_id}/users/${user_id}/display`
);
const response = await fetch(url, {
method: "POST",
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.text();
}
Submitted by hugo697 844 days ago