Crie sua aplicação Vonage
Nesta etapa, você criará uma conta na Vonage Applications capaz de atender a casos de uso de comunicação por voz dentro do aplicativo.
Abra um novo terminal e, se necessário, acesse o diretório do seu projeto.
Crie um aplicativo Vonage copiando e colando o comando abaixo no terminal:
vonage apps create 'Your application'
✅ Creating Application
Saving private key ... Done!
Application created
Name: Your application
Application ID: 00000000-0000-0000-0000-000000000000
Improve AI: Off
Private/Public Key: Set
Capabilities:
None Enabled
vonage apps create 'Your application'
✅ Creating Application
Saving private key ... Done!
Application created
Name: Your application
Application ID: 00000000-0000-0000-0000-000000000000
Improve AI: Off
Private/Public Key: Set
Capabilities:
None Enabled
Agora que seu aplicativo Vonage foi criado, atualize sua autenticação CLI com o ID do aplicativo e a chave privada:
vonage auth set `
--local `
--api-key='your-api-key' `
--api-secret='your-api-secret' `
--app-id='your-application-id' `
--private-key=C:\path\to\private.key
API Key: your-api-key
API Secret: your-**************
App ID: your-application-id
Private Key: Is Set
✅ Checking API Key Secret
✅ Checking App ID and Private Key
vonage auth set ^
--local ^
--api-key='your-api-key' ^
--api-secret='your-api-secret' ^
--app-id='your-application-id' ^
--private-key=C:\path\to\private.key
API Key: your-api-key
API Secret: your-**************
App ID: your-application-id
Private Key: Is Set
✅ Checking API Key Secret
✅ Checking App ID and Private Key
Em seguida, configure os webhooks no seu aplicativo da Vonage. Certifique-se de alterar os valores de --voice-answer-url e --voice-event-url argumentos, substituindo as URLs por https://SUBDOMAIN.loca.lt/voice/answer e https://SUBDOMAIN.loca.lt/voice/event respectivamente. SUBDOMAIN é o valor real utilizado na etapa anterior:
vonage apps capabilities update 00000000-0000-0000-0000-000000000000 voice `
--voice-answer-url='https://example.com/webhooks/voice/answer' `
--voice-event-url='https://example.com/webhooks/voice/event' `
--voice-fallback-url='https://example.com/webhooks/voice/fallback'
✅ Fetching Application
✅ Adding voice capability to application 00000000-0000-0000-0000-000000000000
Name: Your application
Application ID: 00000000-0000-0000-0000-000000000000
Improve AI: Off
Private/Public Key: Set
Capabilities:
VOICE:
Uses Signed callbacks: On
Conversation TTL: 41 hours
Leg Persistence Time: 6 days
Event URL: [POST] https://example.com/webhooks/voice/event
Answer URL: [POST] https://example.com/webhooks/voice/answer
Fallback URL: [POST] https://example.com/webhooks/voice/fallback
vonage apps capabilities update 00000000-0000-0000-0000-000000000000 voice ^
--voice-answer-url='https://example.com/webhooks/voice/answer' ^
--voice-event-url='https://example.com/webhooks/voice/event' ^
--voice-fallback-url='https://example.com/webhooks/voice/fallback'
✅ Fetching Application
✅ Adding voice capability to application 00000000-0000-0000-0000-000000000000
Name: Your application
Application ID: 00000000-0000-0000-0000-000000000000
Improve AI: Off
Private/Public Key: Set
Capabilities:
VOICE:
Uses Signed callbacks: On
Conversation TTL: 41 hours
Leg Persistence Time: 6 days
Event URL: [POST] https://example.com/webhooks/voice/event
Answer URL: [POST] https://example.com/webhooks/voice/answer
Fallback URL: [POST] https://example.com/webhooks/voice/fallback
NOTA: Informações sobre sua aplicação, incluindo o ID da aplicação, também podem ser encontradas no Painel de controle.
Receber uma ligação em um aplicativo
Você recebe uma chamada de um telefone no seu aplicativo