Skip to content

Commit

Permalink
get reservation information for tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
mythilytm committed Jan 29, 2025
1 parent c7ae344 commit f76b650
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions functions/getTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,27 @@ export const handler = TokenValidator(
return;
}
try {
const result = await context
const reservations = await context
.getTwilioClient()
.taskrouter.workspaces(context.TWILIO_WORKSPACE_SID)
.tasks(event.taskSid)
.reservations.list();

console.log('>>> getTask reservations', reservations);

reservations.forEach((reservation) => {
console.log('>>> getTask reservation', reservation);
});

const tasks = await context
.getTwilioClient()
.taskrouter.workspaces(context.TWILIO_WORKSPACE_SID)
.tasks(event.taskSid)
.fetch();
resolve(success(result));

console.log('>>> tasks', tasks);

resolve(success(tasks));
} catch (err) {
const error = err as Error;
if (
Expand Down

0 comments on commit f76b650

Please # to comment.