News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
How do I get the voicemail transcription from a Group using C#
Tags: voicemail
Jul 18, 2023 at 11:52am   •   2 replies  •  0 likes
Bob Colladay

First I am unable to get even my own personal voicemail transcriptions using this method. It find the transcription record but I can't see any parameters with the transcription string.

Second how will I change this to access a Group's voicemail transcription?

Thanks.


using System;
using System.Threading.Tasks;
using RingCentral;

namespace Account
{
    class Account
    {
        static String SERVER_URL = "https://platform.ringcentral.com";
        static String CLIENT_ID = "************";
        static String CLIENT_SECRET = "********";
        static String JWT_TOKEN = "************";    

        static RestClient restClient;

        static void Main(string[] args)
        {
            restClient = new RestClient(CLIENT_ID, CLIENT_SECRET, true, "VoiceMailTranscriptionGet");
            restClient.Authorize(JWT_TOKEN).Wait();
            GetMessage().Wait();
        }



        static private async Task GetMessage()
        {
            ListMessagesParameters parameters = new ListMessagesParameters();
            parameters.messageType = new String[] { "VoiceMail" };
            var response = await restClient.Restapi().Account().Extension().MessageStore().List(parameters);
            foreach (GetMessageInfoResponse record in response.records)
            {
                if (record.attachments != null)
                {
                    foreach (var attachment in record.attachments)
                    {
                        var fileName = "./src/test/resources/" + record.attachments[0].id + "_voicemail.txt";
                        if (attachment.type == "AudioTranscription")
                        {
                            var res = restClient.Restapi().Account().Extension().MessageStore(record.id.ToString()).Content(attachment.id.ToString()).Get();
                            //Path path = Paths.get(fileName);
                            //Files.write(path, res);
                        }
                    }
                }
            }
        }
    }
}


on Jul 18, 2023 at 11:58am   •  0 likes

This is the call queue I will need to access.

https://service.ringcentral.com/application/company/departments/63448800004/messages

1 Answer
answered on Jul 19, 2023 at 9:41am  

First of all, you have to make sure also the voicemail transcription is Completed

if (attachment.type == "AudioTranscription" &&
                                         record.vmTranscriptionStatus == "Completed")
{
    ...
    var res = await restClient.Restapi().Account().Extension().MessageStore(record.id.ToString()).Content(attachment.id.ToString()).Get();
    using (BinaryWriter writer = new BinaryWriter(System.IO.File.Open(path + fileName, FileMode.Create)))
    {
        writer.Write(res);
        writer.Flush();
        writer.Close();
    }
}

If you need to access and download a message store content (e.g. voicemail) of another user extension, including a group's voicemail (call queue), you must authenticate your app with a super admin user, and specify the extension id in the path as shown in the example below:

...
var EXTENSION_ID = "12345678890";
var resp = await restClient.Restapi().Account().Extension(EXTENSION_ID).MessageStore().List(parameters);
                
foreach (var record in resp.records)
{
    ...
    var res = await restClient.Restapi().Account().Extension(EXTENSION_ID).MessageStore(record.id.ToString()).Content(attachment.id.ToString()).Get();
    ...
}



 1
on Jul 19, 2023 at 10:33am   •  0 likes

I added the EXTENSION_ID var and valued it to 9000, now I get "Resource for parameter [extensionId] is not found"

this is for a call queue group with an extension of 9000

vm9000.jpg

on Jul 19, 2023 at 11:10am   •  0 likes

Extension id is not the extension number. 9000 is your queue extension number.

You can read the call queue info using the list extensions API (set the type query param to ["Department"]) and grab the id from the result.

on Jul 19, 2023 at 11:24am   •  0 likes

Ok, thank you. Looks like I'll need to create a new app anyway to add the EditMessages scope so I can mark them as read once I get the transcription.


Thanks

on Jul 19, 2023 at 11:30am   •  0 likes

ok, thanks again



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us