|
| 1 | +--- |
| 2 | +title: Accept/Decline an offer in Job Router |
| 3 | +titleSuffix: An Azure Communication Services how-to guide |
| 4 | +description: Use Azure Communication Services SDKs to manage the job offer |
| 5 | +author: marcma |
| 6 | +ms.author: marcma |
| 7 | +ms.service: azure-communication-services |
| 8 | +ms.topic: how-to |
| 9 | +ms.date: 01/18/2022 |
| 10 | +ms.custom: template-how-to |
| 11 | + |
| 12 | +#Customer intent: As a developer, I want to accept/decline job offers when coming in. |
| 13 | +--- |
| 14 | + |
| 15 | +# Accept/Decline an offer |
| 16 | + |
| 17 | +This guide outlines the steps to observe and response a Job Router offer. |
| 18 | + |
| 19 | +[!INCLUDE [Private Preview Disclaimer](../../includes/private-preview-include-section.md)] |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 24 | +- A deployed Communication Services resource. [Create a Communication Services resource](../../quickstarts/create-communication-resource.md). |
| 25 | +- Optional: Complete the quickstart to [get started with Job Router](../../quickstarts/router/get-started-router.md) |
| 26 | + |
| 27 | +## Observe the offer issued event |
| 28 | +After creating a job, observe the [offer issued event](../subscribe-events.md#microsoftcommunicationrouterworkerofferissued) which contains the worker ID and job offer ID. |
| 29 | + |
| 30 | +```csharp |
| 31 | +var workerId = event.data.workerId; |
| 32 | +var offerId = event.data.offerId; |
| 33 | +Console.WriteLine($"Job Offer ID: {offerId} offered to worker {workerId} "); |
| 34 | + |
| 35 | +``` |
| 36 | + |
| 37 | +## Accept a job offer |
| 38 | + |
| 39 | +Then, the worker can accept the job offer by using the SDK |
| 40 | + |
| 41 | +```csharp |
| 42 | +var result = await client.AcceptJobOfferAsync(workerId, offerId); |
| 43 | + |
| 44 | +``` |
| 45 | + |
| 46 | +## Decline a job offer |
| 47 | + |
| 48 | +Aternatively, the worker can decline the job offer by using the SDK if worker is not willing to take the job. |
| 49 | + |
| 50 | +```csharp |
| 51 | +var result = await client.DeclineJobOfferAsync(workerId, offerId); |
| 52 | + |
| 53 | +``` |
0 commit comments