I'm developing a Java application that will send a sms to the user when a specific event happens. This part is perfectly working, I'm using Twilio to do this. Now I would like to know the steps to follow if I want to send a reply to the received message, for example, when I get a message with the event on my phone, I'd like to send a message to be able to execute some code in my application, i.e. send 1 to kill a process, or send 2 to shut down the computer. I can't find documentation for this specific case. Anyone?
You can use session data (like cookies) to track the back and forth between a specific phone number and their requests.
https://www.twilio.com/docs/quickstart/java/sms/tracking-conversations
You can use this to store information about the senders previous requests. If you want it to execute some code based off their message (i.e. if they send the number 1 it does some code) you can use a case statement.
Twilio's FAQ says:
When an SMS message is received by one of your Twilio numbers,
Twilio makes an HTTP request to the SMS Request URL configured for that number
Configure your twilio phone number to send a request to your app when an in-bound SMS is received. You can set the url for in-bound SMS messages through the twilio console.
Related
I am developing an application in android (Twilio Android Client) using Twilio, which consumes the Rest API.
I can successfully send the SMS using the rest API. However, when someone replies to SMS/MMS, the server will get that message because Twilio will hit that URL.
But on the other hand, I don't understand how to update the client device when we receive an SMS/MMS using Twilio.
Is there any way to update or send the message (SMS/MMS) to the client device when a server receives an incoming message(SMS/MMS)?
You can configure a URL for SMS/MMS in your twilio number. Now, when the user replies to this number, this script in this URL will be executed. In this script, write code to forward SMS/MMS to your android device's phone number.
If you want to handle replies solely via your app, (ie, not by conventional SMS and MMS) then store reply SMS and MMS in server. Then write an API in server to get these messages. Now write code in android to periodically query this API and retrieve these messages.
I have this app that sends encrypted text messages to the specified phone number. When a message is received, it shows up in my app but also in any other SMS app I have installed. I want to disable the global notification of the received text message.
What I am trying to do is send an encrypted message as a regular text message and send the key to decrypt it as a private message that is not displayed in the chat log. My app should have some kind of notifier to know which incoming message is the key and which is the encrypted text.
I read about using a localbroadcastmanager but I had no luck getting that to work with my code setup. I also was not sure if the manager would be able to send messages to other phone numbers.
I can post code snippest if necessary, but I don't see a reason for that.
Thanks for your time and any help guys.
UPDATE: I have found some posts about using ports so that only my app will listen for messages coming in from the specified port and no other app will see the messages on that port. I have implemented a quick program to send a message to a port I chose, but the message still shows up in all messaging apps. Do ports do what I think they'll do? Am I just doing something wrong?
Currently, sending a message from my server gives me an OK response, meaning the message has been forwarded to GCM and it will be received by the device unless it's offline, which it will receive once it's online. Would it be possible to determine if the device hasn't received it yet because it's currently offline?
There is no way to query the status of a GCM message after it is sent. One option would be to have your app request a delivery receipt, or manually ack the message via HTTP. Then if your server doesn't get the ack within a certain time you could then send via SMS.
As you then end up sending some messages via GCM and SMS, you will need code to de-duplicate the messages in your app.
now GCM support "message delivered to device", just set "delivery_receipt_requested": true and deal eith incomming ack..
see this
It seems you are using HTTP protocol for sending messages.
If you use XMPP instead, and add "delivery_receipt_requested": true to your JSON, GCM will send a Delivery message to you upon Delivery. (you can find the documents here)
Otherwise you have to handle it manually on HTTP.
I am writing an Android application that needs to communicate via sms. So for example application will send a message "Hi" to number 123, when number 123 receives the message it will be parsed on their phone by my application and acted on if it was determined to have been sent by my app.
Now I have the sending and receiving/parsing of messages working perfectly but I need a way to identify that the message was sent by my app. I could easily semd the message as "appName:hi" and check to see if the body contains 'appName' but the problem is if the user who receives my message doesn't have my app I would prefer if they just saw "Hi". So I was wondering if theres a way for example to send invisible characters or set some other identifying information either in the sms body or as part of the sms itself ie header. I would like to avoid data sms if possible and my app is intended to be offline.
Any ideas how I could accomplish this?
You can specify port when sending SMS. I do not know how to do this with Android API but since this feature has being supported for years by J2ME Android must support it too.
Your application should listen to this port and send to the same port. So, if user already has your application I think he even will not see the message in his inbox. At least this was the behavior in J2ME. If however he does not have the application yet he will either see it in inbox or will not see it at all. Check this with android. As far as I remember in J2ME it depends on the phone model.
We use a MM7 to send the request to MMSC for sending MMS.
Receiving user has an Android phone and He doesn't get the MMS.
But when Receiving user has a feature phone he gets the MMS.
Confusing here. please help.
There is nothing you should specially handle on your MM7 message to make it work with Android.
What do you mean with "But when Receiving user has a feature phone he gets the MMS"? You can check following steps to troubleshoot.
Check if phone can receive multimedia messages from other sources, try to send a multimedia message to your android phone from another phone. If not, check MMS settings on your android phone.
Check status of message on MMSC side. If you can access server you can check network dump and extract your message.
Request for delivery reports while submitting your MM7 message