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 ?

gefragt vor 2 Jahren207 Aufrufe
1 Antwort
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
beantwortet vor 2 Jahren
  • 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);

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen