Amazon Connect: Example of Click to Call in JavaScript

0

Hello All, Is there an example code for a click to call from a web page, possibly using the V3 using javascript ?

已提問 2 年前檢視次數 207 次
1 個回答
0

When connected to ccp assign agent to a variable

connect.agent((agent) => {
          window.CCP.agent = agent;
	})

Then you can make a call as below:

const endpoint = connect.Endpoint.byPhoneNumber(phoneToDial);
        window.CCP.agent.connect(endpoint, {
            failure: (e: any) => {
                console.log("call failed");
            }
        })
bbolek
已回答 2 年前
  • thanks @bbolek . But I have further questions . I am trying to use the javascript v3 for Connect ( https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-connect/index.html ) And my current problem is the connection is refused . I think I am missing a parameter either during creating ConnectClient or StartOutboundVoiceContactCommand (see below ) . I get error "Uncaught (in promise) Error: Credential is missing"

    //code fragment import { ConnectClient, AssociateApprovedOriginCommand, StartOutboundVoiceContactCommand } from "@aws-sdk/client-connect";

    const client = new ConnectClient({ region: "us-west-2" }) /// const params = { "ContactFlowId": "36c5ea54-XXXX-XXXX-XXXXX-XXXXXXXX", "DestinationPhoneNumber": "+1XXXXXXXXXX", "InstanceId": "arn:aws:connect:us-west-2:XXXXXXX", }; const command = new StartOutboundVoiceContactCommand(params); client.send(command);

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南