Unfortunately, outbound message notification does not include the message payload, nor the "from" and "to" info. What is your use case?
Hi Phong,
We were trying to get all the SMS messages to ingest those in another system, we were taking a look, and we decide to use that event, as the payload had direction as a parameter, we were thinking Inbound and Outbound should be the values, but it seems only works for Inbound. After that, we decided to get Inbound with that event and Outbound with message-store?type=SMS&direction=Outbound and then get the Message ID and do an API call to getMessges to have the text of the messages + from and to.
Do you know, for instant message events if there is another value for direction?
Thanks
Hi Mr. @Phong Vu ,
We are only receiving the webhook for inbound messages and there is no webhook call for outbound messages. Could you please suggest if there is a way to listen to outbound message events?
Any help is highly appreciated.
Thanks!
The only way we know how to do this is by running a job that checks to see if the message is sent ever minute. Is there not a better way? That solution is not ideal.
We are building a CRM system where we send and receive texts to our clients from the system. We have no problems receiving the texts. Our problem is that we can't confirm if something is sent without running a job every minute.
Please advise us on the best way to proceed. If we have to run the job ever minute, we can. We just want a better way if it is possible. Thank you in advance.
Here is how you can get notified for both inbound and outbound new text message events
var eventFilters = ['/restapi/v1.0/account/~/extension/~/message-store?type=SMS']
// E.x using PubNub notification
subscription.on(subscription.events.notification, async function(msg) {
for (var message of msg.body.changes){
for (var msgId of message.newMessageIds){
await readMessageDetail(msgId)
}
}
});
async function readMessageDetail(msgId){
try{
var resp = await platform.get(`/restapi/v1.0/account/~/extension/~/message-store/${msgId}`)
var jsonObj = await resp.json()
console.log(JSON.stringify(jsonObj)
}catch(e){
console.log(e.message)
}
}
Alternative way to get inbound text message with message detailed in the event body, and, you can subscribe for separate events as follows:
'/restapi/v1.0/account/~/extension/244609004/message-store/instant?type=SMS'
'/restapi/v1.0/account/~/extension/233723004/message-store?direction=Outbound&type=SMS',