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);

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠