Setting up authentication
In order to connect to an Vonage Video session, the client will need access to some authentication credentials — an APP ID, session ID, and token. In a production application, these credentials should be generated using a Server SDKs, but to speed things up we will hard code the values for now:
- Create a new Kotlin file named
VonageVideoConfig.ktand add the following object:
object VonageVideoConfig {
// Replace with your Vonage Video APP ID
const val APP_ID = ""
// Replace with your generated session ID
const val SESSION_ID = ""
// Replace with your generated token
const val TOKEN = ""
}
- Adjust the code by hard coding the values for the
APP_ID,SESSION_IDandTOKEN. You can obtain them by following the instructions below:
Create a Vonage API Application
There are two alternative methods for creating a Messages application:
- Using the Vonage CLI
- Using the Dashboard
Each of these methods is described in the following sections.
How to create a Messages application using the Vonage CLI
To create your application using the Vonage CLI, enter the following command into the shell:
This creates a Vonage API application with a messages capability, with the webhook URLs configured as specified, and generate a private key file my_messages_app.key and creates or updates the vonage_app.json file.
How to create a Messages application using the Dashboard
You can create Messages application in the Dashboard.
To create your application using the Dashboard:
Under Applications in the Dashboard, click the Create a new application button.
Under Name, enter the Application name. Choose a name for ease of future reference.
Click the button Generate public and private key. This will create a public/private key pair and the private key will be downloaded by your browser.
Under Capabilities select the Messages button.
In the Inbound URL box, enter the URL for your inbound message webhook, for example,
https://example.com/webhooks/inbound-message.In the Status URL box, enter the URL for your message status webhook, for example,
https://example.com/webhooks/message-status.Click the Generate new application button. You are now taken to the next step of the Create Application procedure where you can link a Vonage API number to the application, and link external accounts such as Facebook to this application.
If there is an external account you want to link this application to, click the Linked external accounts tab, and then click the corresponding Link button for the account you want to link to.
You have now created your application.
NOTE: Before testing your application ensure that your webhooks are configured and your webhook server is running.
Important: You can continue to get the session ID and token values from your Account during testing and development, but before you go into production you must set up a server.
For more information on sessions, tokens, and servers, check out Video API Technical Details.
Basic video chat
Learn the basic concepts of the Vonage Video API platform, including how users can communicate through video, voice, and messaging. Explore a basic Vonage Video API flow.