Get MessageId from WebHook

  • 1
  • Question
  • Updated 6 months ago
We are in the process of integrating web hook functionality so our app will have NRT (near-real-time) displaying of data. We have the mechanism set up, and are receiving event notifications. However, when we receive a notification for a new voicemail message, I receive the following:
{
	"uuid": "788125201093500980",
	"event": "/restapi/v1.0/account/134636004/extension/134636004/message-store",
	"timestamp": "2018-01-18T16:53:59.486Z",
	"subscriptionId": "0e677729-95ec-4ad6-9bd3-a00213ab2981",
	"ownerId": "134636004",
	"body": {
		"extensionId": 134636004,
		"lastUpdated": "2018-01-18T16:53:47.713+0000",
		"changes": [{
			"type": "VoiceMail",
			"newCount": 1,
			"updatedCount": 0
		}]
	}
}

It's just a notification that there is/are new message(s) in the store. As far as I can tell, there is no indicator for the actual new MessageId in the store. With only this information, I have to query the message store for the latest messages, and compare them to messages we have already logged in our system in order to get the new one. This seems to defeat the purpose of using WebHooks. I could just as easily use a frequent polling method to get the latest messages from the message store without WebHooks, and get similar NRT results. 

Am I missing something here? I see that call log notifications use something similar, but they have a SessionId, and I can query from the call log store using that SessionId to get my call info.

Is there a separate event filter I can subscribe to in order to get the message id of new messages? Or is there something similar to the session id that I can use with messages, in order to get only the new message?

Or, is this just the way it is?

Thanks
Photo of Matt Spinks

Matt Spinks

  • 416 Points 250 badge 2x thumb

Posted 6 months ago

  • 1
Photo of Anton Nikitin

Anton Nikitin, Official Rep

  • 2,612 Points 2k badge 2x thumb
Matt, unfortunately we don't have instant voicemail notifications (only SMS instant notifications are supported) at the moment but plan to implement them in the future (Q2-2018 is the earliest I assume).
Photo of Matt Spinks

Matt Spinks

  • 416 Points 250 badge 2x thumb
Ok. Thanks for the info. I wanted to make sure I wasn't missing something.
Photo of Phong Vu

Phong Vu, Devangelist

  • 2,256 Points 2k badge 2x thumb
Hi Matt,

While there is no dedicated notification event for VoiceMail, can you try a workaround solution below to see if it helps.

Register for both message-store and missed-calls event
var eventFilters = []
eventFilters.push('/restapi/v1.0/account/~/extension/~/message-store')
eventFilters.push('/restapi/v1.0/account/~/extension/~/missed-calls')
You will receive 2 notifications. One for a missed call event and another one for a new message event. You can use the sessionId from the missed call event to fetch the info of the voicemail in this case. Please try and let me know.

Bests,
Phong Vu