{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":4528,"path":"conversational-interfaces/advanced-work-assignment/config-extrnlroute-event-payload.md","title":"Configure External Routing events and payload","bundle":null,"doc_type":null,"release":"australia","body":"\n# Configure External Routing events and payload\n\nConfigure Advanced Work Assignment with external routing using AWA External Service API for CCaaS and third-party providers to enable them to submit events.\n\n## Before you begin\n\nRole required: admin\n\n## About this task\n\nWhen AWA Queue is configured for external routing, it enables for setting up a REST endpoint corresponding to the CCaaS entry point for routing, which:\n\n-   Makes the schema changes needed to associate with an AWA External queue with the CCaaS REST endpoint.\n-   Provides the following fields to provide the payload for the REST call:\n    -   Case \\(sn\\_customerservice\\_case\\)\n    -   Task \\(sn\\_customerservice\\_case\\)\n    -   Interaction \\(interaction\\)\n\nConfiguring AWA with external routing enables you to consolidate the routing of ServiceNow channels \\(such as Chat, Cases, or Incidents\\) and the CCaaS channels. The AWA External Service API involved in the configuration plays a key role:\n\n-   Detects the Work Item \\(created or transferred\\)\n-   Uses the External AWA Service API pushEvent \\(EVENT\\_TYPE\\) function to pass the Work Item.\n-   Generates the request payload and constructs the flow object using the The ExternalAWAServiceAPI.\n-   Pushes the events to the external system using the Subflow.\n\n## Procedure\n\n1.  Navigate to the queue settings through one of the following navigation paths:\n\n    -   **All** &gt; **Advanced Work Assignment** &gt; **Home**.\n\n        In the Essential settings section, select **Set up queues**.\n\n    -   **All** &gt; **Advanced Work Assignment** &gt; **Queues**.\n2.  Select an existing External Routing Queue item or create one.\n\n3.  Select the **External** check box to create an external routing Work Item.\n\n    **Note:** If you selected an existing AQA Queue item, verify that external routing is enabled with the **External** field checked.\n\n4.  In the External third-party routing section of the queue form, select the Preview this record icon \\[Omitted image \"preview-record-icon.png\"\\] Alt text: Preview this record icon. and select **Open record**.\n\n    **Note:** You are notified to save the Queue record for any changes you made upon navigating. Select **Update** for an existing queue or select **Submit** for a new queue.\n\n5.  Select the **Subflow** from the list of flows available to send events to the selected provider.\n\n    \\[Omitted image \"select-awa-exrnl-subflow.png\"\\] Alt text: Select subflow to send events to the provider.\n\n6.  Select the required External Event Definitions for the provider.\n\n    The selected External Event Definitions are associated with the provider to define the external events that must be handled by the provider. You can either select from the existing event definitions or create one.\n\n7.  Select an external event definition to see the **Event type** and **Payload** that it contains.\n\n    \\[Omitted image \"awa-extrnl-event-defntn.png\"\\] Alt text: Event type and payload of the subflow associated with the provider.\n\n    **Note:** Ensure that you do not add any info message or error message after answer block. Answer should be always return string, if answer is in try block, you can add info/error messages in catch block.\n\n    Use the following items that are available by default, to construct the payload contents you want on the external system:\n\n    -   `current` = Represents the AWA Work item record\n    -   `docuemntGR` = Represents the interaction or task referenced by the Work Item.\n    -   `additionalParams` = Contains objects with the values of the Work Item document's fields.\n    -   payload script = Contains scriptable APIs.\n8.  Select **Update**.\n\n    The Agent chat queue is configured to the external routing queue.\n\n\n## Result\n\nAfter the configuration, all the incoming chats are routed to the external queue and you can see the list of work items sent to the external queue in the Work Items \\[awa\\_work\\_items\\] table. You can find the recorded event logs of the subflows associated with the provider in the Flow engine contexts \\[sys\\_flow\\_context\\] table.\n\nTo view the execution details of the event payload, open an event record from the Flow engine contexts \\[sys\\_flow\\_context\\] table and select **Open in Operations View**. You will see the AWA Post External Routing Events flow with the payload.\n\n\\[Omitted image \"executed-external-routing.png\"\\] Alt text: Executed external event payload.\n\n"}}