How to logout amazon connect CCP with embeded connect Streams

0

I have embeded the amazon connect streams in my angular project. i have implemented the logout functionality. e.g.

this.getAgent((agent: any) => {
      const { agentStateARN, type, name } = agent.getAgentStates().find((state: any) => state.type == "offline");
      agent.setState(
        {
          agentStateARN,
          type,
          name
        },
        {
          success: function (this: any) {
            this.terminateCCP();
            this.agentService.setAgent(undefined);
            const instanceURL = environment.amazoneConnecDomain + environment.amazonConnectLoout;

            fetch(instanceURL, {
              credentials: "include",
              mode: "no-cors"
            }).then(() => {
              const eventBus = connect.core.getEventBus();
              eventBus.trigger(connect.EventType.TERMINATE);
              this.terminateCCP();
              console.log("Logout");

              this.clearCookies();
              this._router.navigate(["/login"]);
              this.windowRef.removeLoginFromStorage();
              this.ngxLoader.stopBackground();
              location.reload();
            });
          }.bind(this),
          failure: function (err: any) {
            console.log("Couldn't change Agent status to Available. Maybe already in another call?", err);
          }
        },
        true
      );
    });

If we open that customized application in multiple tabs and try to logout from one tab, it does not logout from other tabs.  but by default, CCP If we open multiple CCPs and logout from one CCP, it will automatically logout from others. How we can logout from other tabs using amazon connect streams.

S_Ali
已提问 3 个月前205 查看次数
2 回答
1

When using a custom UI you can logout by visiting / calling the logout endpoint (/connect/logout). From there you can also call core.terminate() to clean up StreamsSDK.

Please also note that the terminate event is not triggered when calling the logout URL, so you may want to trigger the event from your code directly.

Please review this section in the streams documentation. to get a bit more information.

For other tabs you may also want to remove auth token cookies and mentioned in above section.

profile pictureAWS
faddi
已回答 3 个月前
  • @faddi Thank you for the answer. as i mentioned that when i call this code it log me out from the connect. but problem is if the agent logout from the default CCP or if he has opened the application and he logout from the default CCP or from the tab. we are unable to identify that the agent is logout. what i want , is there any event that is triggered when we logout. so we can capture that event and implement the logic. Benefit of that approach is when we logout the agent from one tab we will be able to logout from all tabs. Here i mentioned that when we logout from the default CCP agent.onStateChange(), is triggered for that agent on all tabs and on the default one also

0

Hi @S_Ali, After reading your comment to the response above, I wanted to share some additional information regarding Agent Login/Logout.

Quote:

S_Ali: "but problem is if the agent logout from the default CCP or if he has opened the application and he logout from the default CCP or from the tab. what i want , is there any event that is triggered when we logout. so we can capture that event and implement the logic."

To address this and "capture that event and implement the logic", you can use Amazon Connect Agent Event Streams. I would recommend implementing the logic for handling login/logouts across the Amazon Connect instance (in a custom CCP or in the native Connect CCP) outside of Amazon Connect Streams.

High-level Overview:

  1. First, enable Amazon Connect Agent Event Streams following the guidance here Enable Agent Event Streams,
  2. Define an AWS Lambda function to ingest the Agent Event Streams from Amazon Kinesis Data Streams.
  3. Implement your business logic within the AWS Lambda Function based on the Agent Event Stream Data.

Agent Event Streams Data Model: https://docs.aws.amazon.com/connect/latest/adminguide/agent-event-stream-model.html

Please let me know if this guidance helped, Taylan U.

profile pictureAWS
专家
已回答 3 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则