Skip to main content

I have Customized chat window and I need to connect with salesforce live agent so I integrated LiveAgent API of salesforce. For closing the chat I trigger end chat API I am getting 200 response but chat window is not closing. `

endChat(userId: string){

endChat(userId: string){

        let objArr: User[] = JSON.parse(localStorage.getItem('userCreden'));
        let len = objArr.length;
        let user: User;
        for (let i = 0; i < len; i++) {
            if (userId == objArr[i].userId) {
                user = objArr[i];
                break;
            }
        }

        let sessionIdRespParsed = user.sessresp;

        let live_agent_url = this.appConfig.getConfig().live_agent_server_url;
        this.httpClient.post<HttpResponse<string>>(live_agent_url + '/chat/rest/Chasitor/ChatEnd', {
            "reason":"client"
        }, {
                headers: new HttpHeaders({
                    'X-LIVEAGENT-API-VERSION': '34',
                    'X-LIVEAGENT-AFFINITY': sessionIdRespParsed.affinityToken,
                    'X-LIVEAGENT-SESSION-KEY': sessionIdRespParsed.key,
                    'X-LIVEAGENT-SEQUENCE': '1'
                })
        }).subscribe(
            res => {
                console.log("response of Chat end  " + res);
            },
            err => {
                
            }
        );
    }`

I have Customized chat window and I need to connect with salesforce live agent so I integrated LiveAgent API of salesforce. For closing the chat I trigger end chat API I am getting 200 response but chat window is not closing. `

endChat(userId: string){

    let objArr: User[] = JSON.parse(localStorage.getItem('userCreden'));
    let len = objArr.length;
    let user: User;
    for (let i = 0; i < len; i++) {
        if (userId == objArr[i].userId) {
            user = objArr[i];
            break;
        }
    }

    let sessionIdRespParsed = user.sessresp;

    let live_agent_url = this.appConfig.getConfig().live_agent_server_url;
    this.httpClient.post<HttpResponse<string>>(live_agent_url + '/chat/rest/Chasitor/ChatEnd', {
        "reason":"client"
    }, {
            headers: new HttpHeaders({
                'X-LIVEAGENT-API-VERSION': '34',
                'X-LIVEAGENT-AFFINITY': sessionIdRespParsed.affinityToken,
                'X-LIVEAGENT-SESSION-KEY': sessionIdRespParsed.key,
                'X-LIVEAGENT-SEQUENCE': '1'
            })
    }).subscribe(
        res => {
            console.log("response of Chat end  " + res);
        },
        err => {
            
        }
    );
}`

I have Customized chat window and I need to connect with salesforce live agent so I integrated LiveAgent API of salesforce. For closing the chat I trigger end chat API I am getting 200 response but chat window is not closing.

endChat(userId: string){

        let objArr: User[] = JSON.parse(localStorage.getItem('userCreden'));
        let len = objArr.length;
        let user: User;
        for (let i = 0; i < len; i++) {
            if (userId == objArr[i].userId) {
                user = objArr[i];
                break;
            }
        }

        let sessionIdRespParsed = user.sessresp;

        let live_agent_url = this.appConfig.getConfig().live_agent_server_url;
        this.httpClient.post<HttpResponse<string>>(live_agent_url + '/chat/rest/Chasitor/ChatEnd', {
            "reason":"client"
        }, {
                headers: new HttpHeaders({
                    'X-LIVEAGENT-API-VERSION': '34',
                    'X-LIVEAGENT-AFFINITY': sessionIdRespParsed.affinityToken,
                    'X-LIVEAGENT-SESSION-KEY': sessionIdRespParsed.key,
                    'X-LIVEAGENT-SEQUENCE': '1'
                })
        }).subscribe(
            res => {
                console.log("response of Chat end  " + res);
            },
            err => {
                
            }
        );
    }
added 1140 characters in body
Source Link

I have Customized chat window and I need to connect with salesforce live agent so I integrated LiveAgent API of salesforce. For closing the chat I trigger end chat API I am getting 200 response but chat window is not closing. `

endChat(userId: string){

    let objArr: User[] = JSON.parse(localStorage.getItem('userCreden'));
    let len = objArr.length;
    let user: User;
    for (let i = 0; i < len; i++) {
        if (userId == objArr[i].userId) {
            user = objArr[i];
            break;
        }
    }

    let sessionIdRespParsed = user.sessresp;

    let live_agent_url = this.appConfig.getConfig().live_agent_server_url;
    this.httpClient.post<HttpResponse<string>>(live_agent_url + '/chat/rest/Chasitor/ChatEnd', {
        "reason":"client"
    }, {
            headers: new HttpHeaders({
                'X-LIVEAGENT-API-VERSION': '34',
                'X-LIVEAGENT-AFFINITY': sessionIdRespParsed.affinityToken,
                'X-LIVEAGENT-SESSION-KEY': sessionIdRespParsed.key,
                'X-LIVEAGENT-SEQUENCE': '1'
            })
    }).subscribe(
        res => {
            console.log("response of Chat end  " + res);
        },
        err => {
            
        }
    );
}`

I have Customized chat window and I need to connect with salesforce live agent so I integrated LiveAgent API of salesforce. For closing the chat I trigger end chat API I am getting 200 response but chat window is not closing.

I have Customized chat window and I need to connect with salesforce live agent so I integrated LiveAgent API of salesforce. For closing the chat I trigger end chat API I am getting 200 response but chat window is not closing. `

endChat(userId: string){

    let objArr: User[] = JSON.parse(localStorage.getItem('userCreden'));
    let len = objArr.length;
    let user: User;
    for (let i = 0; i < len; i++) {
        if (userId == objArr[i].userId) {
            user = objArr[i];
            break;
        }
    }

    let sessionIdRespParsed = user.sessresp;

    let live_agent_url = this.appConfig.getConfig().live_agent_server_url;
    this.httpClient.post<HttpResponse<string>>(live_agent_url + '/chat/rest/Chasitor/ChatEnd', {
        "reason":"client"
    }, {
            headers: new HttpHeaders({
                'X-LIVEAGENT-API-VERSION': '34',
                'X-LIVEAGENT-AFFINITY': sessionIdRespParsed.affinityToken,
                'X-LIVEAGENT-SESSION-KEY': sessionIdRespParsed.key,
                'X-LIVEAGENT-SEQUENCE': '1'
            })
    }).subscribe(
        res => {
            console.log("response of Chat end  " + res);
        },
        err => {
            
        }
    );
}`
Source Link

Salesforce Live Agent EndChat api is not working

I have Customized chat window and I need to connect with salesforce live agent so I integrated LiveAgent API of salesforce. For closing the chat I trigger end chat API I am getting 200 response but chat window is not closing.