Record a Conversation

In this code snippet you will see how to record a Conversation.


Ensure the following variables are set to your required values using any convenient method:

Key Description
CONVERSATION_ID Unique ID of the Conversation.


Use your existing application

You will need to use an existing Application that contains Conversations in order to be able to record one. See the Create Conversation code snippet for information on how to create an Application and some sample Conversations.

Install dependencies

gem install nexmo
Initialize your dependencies

Create a file named record_conversation.rb and add the following code:

Copy to Clipboard
client =
  api_key: NEXMO_API_KEY,
  api_secret: NEXMO_API_SECRET,
  application_id: NEXMO_APPLICATION_ID,

View full source

Write the code

Add the following to record_conversation.rb:

Copy to Clipboard
response = client.conversations.record(CONVERSATION_ID, {
  action: 'start',
  split: 'conversation',
  format: 'mp3'

puts response.inspect

View full source

Run your code

Save this file to your machine and run it:

ruby record_conversation.rb

Try it out

When you run the code you will record the specified Conversation.