Skip to content

Voicemail

Sreekanth Narayanan edited this page Oct 12, 2023 · 7 revisions

Introduction

The VoicemailClient is one of these modules. Refer to the Quickstart guide to understand how calling instance is created and different modules are instantiated. VoicemailClient offers variety of functions which are covered below in this document in detail. 

The voicemail client instance needs to be initialized in order to fetch the voicemail backend.

Initializing the VoicemailClient 

   const voicemailClient = calling.voicemailClient; 
   const initResponse = await voicemailClient.init();

Voicemail Information API

Voicemail Response Object

This is the response type returned by the voicemail client for the various functionalities invoked. 

VoicemailResponseEvent

{
  statusCode: number;
  data: {
    voicemailList?: MessageInfo[];
    voicemailContent?: {
      type: string | null;
      content: string | null;
    };
    voicemailSummary?: SummaryInfo;
    voicemailTranscript?: string | null;
    error?: string;
  };
  message: string | null;
};

Fetching Voicemail List

Retrieves the voicemails present in the voicemail box of the user.

   const voicemailListResponse = await voicemailClient.getVoicemailList(OFFSET, OFFSETLIMIT, SORT.DESC, true);
Parameters

options

Name Description Values Required
 sort  Sorting order of voicemail list (ASC | DESC).
 

String

ASC DESC
yes
offset

Number of records to skip.


Number


yes
offsetLimit  Number of voicemail list to fetch from the offset.

String

yes
refresh  Refresh the list of voicemails from backend. Boolean yes
Returns Promise<VoicemailResponseEvent>

Fetching Voicemail Summary

Fetches the count for various categories of voicemails in the user's mailbox. This API response consists of counts for new voicemails received, new urgent voicemails received, old voicemail and old urgent voicemails.

  const voicemailSummaryResponse = await voicemailClient.getVoicemailSummary();
Parameters --
Returns Promise<VoicemailResponseEvent>

An example of the response for voicemail Summary

{
	statusCode: 200,
    data: {
	    voicemailSummary: {
        	newMessages: 2,
        	newUrgentMessages: 1,
        	oldMessages: 3,
        	oldUrgentMessages: 2,
        },	
	},
    message: SUCCESS,
};

Fetching Voicemail Transcription

This API helps in fetching the transcript of a voicemail. The messageID of the voicemail is passed while calling this function.

Note: An example of the messageID stored in the voicemail client is located in the code box below. Please note that the entire string is used as an ID.

v2.0/user/69fde5ad-fb8b-4a1b-9998-b0999e95719b/VoiceMessagingMessages/dfe55899-1f55-474f-8f00-bc5915757070

The function is called using the statement below.

  const voicemailTranscriptResponse = await voicemailClient.getVMTranscript(messageID);
Parameters messageID<string> 
Returns Promise<VoicemailResponseEvent>

An example of the response received while fetching the transcript

{
	statusCode: 200,
    data: {
		transcript: "Transcript text",
	},
    message: READY | FAILURE | NA | PENDING,
};

Note: The transcript object will populate the string only when the transcription is complete and READY. FAILURE indicates that the voicemail service was unable to transcribe the voicemail, while PENDING indicates that transcription is in progress. NA indicates that transcription is not enabled for the user's voicemails.

Voicemail Action APIs

Marking Voicemail As Read

This API helps in marking the voicemail as Read for the given messageID..

  const voicemailMarkAsReadResponse = await voicemailClient.voicemailMarkAsRead(messageID);
Parameters

messageID<string>

Returns Promise<VoicemailResponseEvent>

An example of the response while marking a voicemail read.

{
	statusCode: 200,
    data: {},
    message: SUCCESS,
};

Marking Voicemail As Unread

This API helps in marking the voicemail as Unread for the given messageID.

  const voicemailMarkAsUnreadResponse = await voicemailClient.voicemailMarkAsUnread(messageID);
Parameters

 messageID<string> 

Returns Promise<VoicemailResponseEvent>

An example of the response received while marking the voicemail unread.

{
	statusCode: 200,
    data: {},
    message: SUCCESS,
};

Deleting a Voicemail

 This API helps in deleting the voicemail for the given messageID.

  const voicemailDeleteResponse = await voicemailClient.deleteVoicemail(messageID);
Parameters messageID<string>  
Returns

Promise<VoicemailResponseEvent>

An example of the response received while deleting a voicemail from the user's mailbox.

{
    statusCode: 200,
    data: {},
    message: SUCCESS,
};
Clone this wiki locally