How to get the status of a Twilio Notification using the sid? - twilio

I am using the Notifications APIs (Twilio Java SDK version 7.24.2). I've successfully sent the SMSes using the Notification API like:
private String sendMessageThroughNotificationService(String message, PhoneNumber receiverPhoneNumber){
Notification notification = Notification.creator(twilioNotificationSID)
.setBody(message)
.setToBinding(Promoter.listOfOne("{\"binding_type\":\"sms\", \"address\":\""+receiverPhoneNumber.toString()+"\"}"))
.create();
return notification.getSid();
}
Now, what should I do if I want to get the Notification's status through the SID of the notification that I am returning from the above method?
Does Twilio's Java Notification's API provide any way to find the Notification's status through its SID (if I don't want to use the register callback URL approach)?

Twilio developer evangelist here.
If you are only sending one notification at a time via SMS, then I recommend you just use the Messages API. That way the API will return the Message SID, which you can then use to look up the Message with the API and check its status.
There is no way to look up all the messages sent via Notify in order to check their statuses. The recommended method there is to register a StatusCallbackUrl to get updates on each status.
Let me know if that helps at all.

Related

Retrieve twilio voice logs via webhook

I've checked the documentation and it explains how to retrieve call logs via API calls, but there does not seem to be a webhook available whenever a log is created :')
Is there an easy way to get notified whenever twilio creates a log for any number?
Twilio doesn't have webhooks that are fired on the creation of call logs.
You could however utilise the incoming call & status callback webhooks on phone numbers within the account to determine when specific actions are fired and begin any actions needed.

How to unsubscribe messaging/voice webhook to stop receiving events occurred in a number?

In Twilio, after we register a webhook URL in an active number, we'll be able to get event notifications whenever events occour in the registered number depending on the type of webhook we registered (Voice/SMS).
The registration of the webhook can be achieved via REST API. Similarly is there any API to stop the webhook notification? Else how should we handle this?
The same API, incomingPhoneResource, would be used do the same. You should be able to create, read, update and delete the configured webhooks for voice and SMS phone number configurations this way.

How to get sent message immediately with Send & Wait for Reply Widget - Twilio Studio

Hey Twilio Developer Evangelists, is there any way to get the sent message immediately with Send & Wait for Reply Studio Widget. It exposes three options:
Reply
No reply
Delivery Fails
But I am specifically looking for the Delivered option so, I can do something without waiting for a reply. I do want to wait for the reply but I also want to get the sent message right after it's sent. Is there any way I can achieve this? With webhooks to receive the sent message OR any other way?
With programmable messaging, Twilio gives an option to track the status of the sent message with statusCallback parameter but I do not see any option to provide a status callback in the studio widget.
Twilio developer evangelist here.
There is no way, that I know of, to achieve this in Studio. There is also no way to set a general statusCallback URL for outbound messages from a number.

How to get SID of each phone used in twillio notification API call

I am sending SMS to the list of million of phone numbers Through twillio notification API.
But I want to keep track about SID against each phone used. so that I can process it further for any phone number.
So what's the better way.
is there a way that allow me to get phone SID by providing phone number to the API.But again there will be issue that sometimes I send multiple messages to the same phone number.
How can I do this. As making twillio notification call to send bulk sms it does not return SID's of every number used in binding
You can use the statusCallback in the Messaging Service Twilio Notify is using to get the Messaging SID's for each. Make sure your server infrastructure can handle the volume of webhooks Twilio returns to it.

Receiving notifications from Slack Direct messages

I'm building a simple slack bot and can currently send private messages as well as checking for the last 10 messages received within this one-to-one channel.
Is there a way of getting a POST notification to my webservice whenever the user replies, instead of having to poll and continuously check messages on that one-to-one channel?
Now you can make use of Slack events to receive notifications.
In the give use-case, 'Message' event can be used to capture message received and process accordingly.
https://api.slack.com/events/message
Bots generally work by connecting to the real-time messaging API, a WebSocket-based API that sends you events as they happen. Specifically, you should see a message event sent to you every time a message visible to your bot is sent.
To answer your question, there's no way to get an HTTP POST sent to you instead; you'll need to connect to the RTM API and listen for events that way.

Resources