Skip to main content
New Participant
September 26, 2022
Solved

Is there an API function to clear or reset a voice mailbox?

I can change a users details like name, email address, role and also the delete the call log via the API but how can I also automatically clear any saved or unheard messages before a new user takes over a number please?

    PhongVu
    PhongVuAnswer
    Community Manager
    September 27, 2022

    Yes, you can call the Get Message List API to read all messages (set messageType=VoiceMail if you only want to read voicemail messages) of an extension. Then grab all the message ids and call the Delete Message API to delete them. The delete message takes an array of message ids so you can delete them all in 1 API call. Remember to set the purge=true to delete all attachments associated with those messages. Here is an example in Node JS to delete a single message and its associated attachments:

    async function deleteMessage(id){
      await platform.delete(`/restapi/v1.0/account/~/extension/~/message-store/${id}?purge=true`)
    }

    1 reply

    PhongVu
    Community Manager
    PhongVuAnswer
    Community Manager
    September 27, 2022

    Yes, you can call the Get Message List API to read all messages (set messageType=VoiceMail if you only want to read voicemail messages) of an extension. Then grab all the message ids and call the Delete Message API to delete them. The delete message takes an array of message ids so you can delete them all in 1 API call. Remember to set the purge=true to delete all attachments associated with those messages. Here is an example in Node JS to delete a single message and its associated attachments:

    async function deleteMessage(id){
      await platform.delete(`/restapi/v1.0/account/~/extension/~/message-store/${id}?purge=true`)
    }