Interface for the Voicemail Module. This interface provides a set of APIs for retrieving and updating voicemail, including operations such as retrieving voicemail lists, messages count summary, marking as read/unread, and accessing voicemail transcripts.

These APIs return promises that resolve to a VoicemailResponseEvent object, which includes a status code, data, and message. The data field within this response object may contain various objects, with different types depending on the specific API used.

Example

A successful response will be structured as follows:

{
statusCode: 200,
data: {
voicemailTranscript: "Example"
},
message: 'SUCCESS'
}

A failure response will be structured as follows:

{
statusCode: 503,
data: {
error: "Failure reason"
},
message: 'FAILURE'
}

Hierarchy

  • IVoicemail

Implemented by

Methods

  • Retrieves a list of voicemails with optional pagination and sorting options. Received data can be accessed through data.voicemailList

    Example

    const voicemailResponse = await voicemailInstance.getVoicemailList(0, 10, SORT.ASC);
    

    The voicemailResponse object will have voicemailList object as properties in data attribute.

    {
    statusCode: 200,
    data: {
    voicemailList: [messages]
    }
    }

    Parameters

    • offset: number

      The offset for pagination. Number of records to skip.

    • offsetLimit: number

      The limit on the number of voicemails to retrieve from the offset.

    • sort: SORT

      Sort voicemail list (eg. ASC | DESC).

    • Optional refresh: boolean

      Set to true to force a refresh of voicemail data from backend (optional).

    Returns Promise<VoicemailResponseEvent>

  • Retrieves the content of a voicemail message based on its messageId. Received data can be accessed through data.voicemailContent

    Example

    const messageId = 'Y2lzY29zcGFyazovL3VzL01FU1NBR0UvNTc3OTQ2NjItNDA5OS00NDQ3LWI';
    const voicemailResponse = await voicemailInstance.getVoicemailContent(messageId);

    The voicemailResponse object will have voicemailContent object as properties in data attribute.

    {
    statusCode: 200,
    data: {
    voicemailContent: {
    type: 'message',
    content: 'something'
    }
    }
    }

    Parameters

    • messageId: string

      The identifier of the voicemail message.

    Returns Promise<VoicemailResponseEvent>

  • Retrieves a quantitative summary of voicemails for a user. Received data can be accessed through data.voicemailSummary

    Example

    const voicemailResponse = await voicemailInstance.getVoicemailSummary();
    

    The voicemailResponse object will have voicemailSummary object as properties in data attribute.

    {
    statusCode: 200,
    data: {
    voicemailSummary: {
    newMessages: 1,
    oldMessage: 7,
    newUrgentMessages: 0,
    oldUrgentMessages: 0
    }
    }
    }

    Returns Promise<null | VoicemailResponseEvent>

  • Marks a voicemail message as read based on its message identifier. Note: Response will have a statusCode and message. But data attribute is not returned in the response unless it is an error response in that case data will have error attribute.

    Parameters

    • messageId: string

      The identifier of the voicemail message to mark as read.

      const messageId = 'Y2lzY29zcGFyazovL3VzL01FU1NBR0UvNTc3OTQ2NjItNDA5OS00NDQ3LWI';
      const voicemailResponse = await voicemailInstance.voicemailMarkAsRead(messageId);

      The voicemailResponse object will be populated as below:

      {
      statusCode: 200,
      message: "SUCCESS"
      }

      The voicemailResponse object will be populated as below in case of error response:

      {
      statusCode: 404,
      message: "FAILURE"
      data: {
      error: "Failure reason"
      }
      }

    Returns Promise<VoicemailResponseEvent>

  • Marks a voicemail message as unread based on its message identifier. Note: Response will have a statusCode and message. But data attribute is not returned in the response unless it is an error response in that case data will have error attribute.

    Example

    const messageId = 'Y2lzY29zcGFyazovL3VzL01FU1NBR0UvNTc3OTQ2NjItNDA5OS00NDQ3LWI';
    const voicemailResponse = await voicemailInstance.voicemailMarkAsUnread(messageId);

    The voicemailResponse object will be populated as below:

    {
    statusCode: 200,
    message: "SUCCESS"
    }

    Parameters

    • messageId: string

      The identifier of the voicemail message to mark as unread.

    Returns Promise<VoicemailResponseEvent>

  • Deletes a voicemail message based on its message identifier. Note: Response will have a statusCode and message. But data attribute is not returned in the response unless it is an error response in that case data will have error attribute.

    Example

    const messageId = 'Y2lzY29zcGFyazovL3VzL01FU1NBR0UvNTc3OTQ2NjItNDA5OS00NDQ3LWI';
    const voicemailResponse = await voicemailInstance.deleteVoicemail(messageId);

    The voicemailResponse object will be populated as below:

    {
    statusCode: 200,
    message: "SUCCESS"
    }

    Parameters

    • messageId: string

      The identifier of the voicemail message to delete.

    Returns Promise<VoicemailResponseEvent>

  • Retrieves the transcript of a voicemail message based on its message identifier. Received data can be accessed through data.voicemailTranscript

    Example

    const messageId = 'Y2lzY29zcGFyazovL3VzL01FU1NBR0UvNTc3OTQ2NjItNDA5OS00NDQ3LWI';
    const voicemailResponse = await voicemailInstance.getVMTranscript(messageId);

    The voicemailResponse object will have voicemailTranscript object as properties in data attribute.

    {
    statusCode: 200,
    data: {
    voicemailTranscript: 'Here is your transcript.'
    }
    }

    Parameters

    • messageId: string

      The identifier of the voicemail message.

    Returns Promise<null | VoicemailResponseEvent>

  • Resolves contact information based on calling party information.

    Example

    const callingPartyInfo = { userId: "Y2lzY29zcGFyazovL3VzL1BFT1BMRS8wZmVh" };
    const contactInfo = await voicemailInstance.resolveContact(callingPartyInfo);

    Parameters

    • callingPartyInfo: CallingPartyInfo

      The calling party information for contact resolution.

    Returns Promise<null | DisplayInformation>