Create an Instant Meeting Room

This code snippet shows how to create an instant (default) room using the Meetings API.

See the API Reference for more information.

Example Request

Where needed, replace the following variables in the sample code with your own values:

KeyDescription
JWT

Used to authenticate your request. See Authentication for more information, including how to generate a JWT.

ROOM_DISPLAY_NAME

The name of the meeting room.

VONAGE_APPLICATION_ID

The Vonage Application ID.

VONAGE_APPLICATION_PRIVATE_KEY_PATH

Private key path.

Write the code

Add the following to create-instant-room.sh:

curl -X POST https://api-eu.vonage.com/meetings/rooms \
  -H "Authorization: Bearer $JWT" \
  -H "Content-Type: application/json" \
  -d '{
      "display_name":"'$ROOM_DISPLAY_NAME'"
   }'

View full source

Run your code

Save this file to your machine and run it:

sh create-instant-room.sh

Prerequisites

npm install @vonage/server-sdk

Create a file named request.js and add the following code:

const { Meetings, MeetingType } = require('@vonage/meetings');

const credentials = new Auth({
  privateKey: VONAGE_APPLICATION_PRIVATE_KEY_PATH,
  applicationId: VONAGE_APPLICATION_ID,
});

const meetingsClient = new Meetings(credentials);

View full source

Write the code

Add the following to request.js:

  type: MeetingType.INSTANT,
  displayName: ROOM_DISPLAY_NAME,
})
  .then((room) => console.log(room))
  .catch((error) => console.error(error));

View full source

Run your code

Save this file to your machine and run it:

node request.js

Prerequisites

composer require Vonage

Write the code

Add the following to create-instant-room.php:

<?php

require_once __DIR__ . '/../config.php';
require_once __DIR__ . '/../vendor/autoload.php';

$client = new Vonage\Client(
    new Vonage\Client\Credentials\Keypair(VONAGE_APPLICATION_PRIVATE_KEY_PATH, VONAGE_APPLICATION_ID),
);

$room = new \Vonage\Meetings\Room();
$room->fromArray(['display_name' => ROOM_DISPLAY_NAME]);
$meeting = $client->meetings()->createRoom($room);

View full source

Run your code

Save this file to your machine and run it:

php create-instant-room.php

Prerequisites

pip install vonage

Create a file named request.py and add the following code:


import vonage

client = vonage.Client(
    application_id=VONAGE_APPLICATION_ID,
    private_key=VONAGE_PRIVATE_KEY,

View full source

Write the code

Add the following to request.py:

View full source

Run your code

Save this file to your machine and run it:

python request.py

Prerequisites

gem install vonage

Create a file named create-instant-room.rb and add the following code:

client = Vonage::Client.new(
  application_id: VONAGE_APPLICATION_ID,
  private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH)
)

View full source

Write the code

Add the following to create-instant-room.rb:

room = client.meetings.rooms.create(display_name: ROOM_DISPLAY_NAME)

View full source

Run your code

Save this file to your machine and run it:

ruby create-instant-room.rb

Example Response

Your Instant Room has been created.

When an instant room is created, the expiration date is set to 10 minutes.

{
   "id":"a66e451f-794c-460a-b95a-cd60f5dbdc1a",
   "display_name":"New Meeting Room",
   "metadata":null,
   "type":"instant",
   "expires_at":"2021-10-19T17:54:17.219Z",
   "expire_after_use": false,
   "join_approval_level": "abc123",
   "recording_options":{
      "auto_record":false,
      "record_only_owner":false
   },
   "meeting_code":"982515622",
   "_links":{
      "host_url":{
         "href":"https://meetings.vonage.com/?room_token=982515622&participant_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjYyNjdkNGE5LTlmMTctNGVkYi05MzBmLTJlY2FmMThjODdj3BK7.eyJwYXJ0aWNpcGFudElkIjoiODNjNjQxNTQtYWJjOC00NTBkLTk1MmYtY2U4MWRmYWZiZDNkIiwiaWF0IjoxNjM0NjY1NDU3fQ.PmNtAWw5o4QtGiyQB0QVeq_qcl6fs0buGMx5t4Fy43c"
      },
      "guest_url":{
         "href":"https://meetings.vonage.com/982515622"
      }
   },
   "created_at":"2021-10-19T17:44:17.220Z",
   "is_available":true
}