Once I have received a message in Skype, I would like to be able to get the username of the sender as well as the content of the message using Skype4Java. How would I go about doing this?
message.getContent().getSender().getUsername();
Related
I have sent my mail through java mail and registered my email on Amazon to get the response notifications (Bounce, Delivered) etc.
How can i succesfully match these two to say when i have sent the mail, the mail i sent has the following incomming response.
Note: Everything is setup (Webhooks to get the response from AWS SNS)
I tried matching it by the messageId, but it seems aws adds a different messsageId than the java mail one. Example
MimeMessage msg = new MimeMessage(session);
msg.getMessageID(); // returns "<1619401941.3.1560500581268#Tinus-NB>"
And the from the AWS SNS response
"MessageId" : "7cd42bc4-e5c2-576b-a567-7eb9baa51cad" // directly
"Message" : "{\"notificationType\":\"Delivery\",\"mail\":{\"timestamp\":\"2019-06-14T08:38:55.113Z\",\"messageId\":\"0102016b5523c189-55acd572-ba3f-4750-aaae-b7019080f1ae-000000\",\"delivery\":{\"timestamp\":\"2019-06-14T08:39:03.043Z\",\"processingTimeMillis\":7930,\"smtpResponse\":\"250 2.0.0 OK 1560501543 f15si1572805ede.113 - gsmtp\"}}" // this is in the Message object in the JSON
Just to be clear, I want to match these two, to know what i sent and what the response was.
I am using Java Mail and not the AWS SDK lib
SES overwrites MessageID whatever you set because it also needs to know which email is it. In your case, when sending emails from Javamail,in the last section of your code, you can print the 250 response code+ message ID from SES and match it with the message ID you received from SNS.
When SES accepts an email in SMTP conversation, it gives 250 ok+ message ID and the same message ID can be seen in SNS notification.
Found it, i just had to include the original headers
When I run the standalone IBM MQ JMS client to send and receive the message. I got the below reply message and the correlationID.
The message I send to the Queue:
REQUEST(SER,10,TEST,MSGID,20 ..
I got the Reply message as below:
REPLY(MSGID,20,DTO0240,SER,10,TEST
correalationID
after sending a message we get message id
ID:414d51204243573032413154202020205bc6bd3e254d4820
I need to store the Message ID and the reply message in the Data base but My doubt is how to get the Matching (MSG ID 20) from the reply message to store in the database . Is it possible to get from the reply message. I got confusion.
When I store in the DB do I store only the correalation ID
(ID:414d51204243573032413154202020205bc6bd3e254d4820) only possible.
MY DB has column:
MessageID requestMessage replymessage and Flag. Based on Flag "N"
I will read and send to the Queue and once I got reply i need to update back the reply message based on MessageID. so Is it possible to get the Message ID from the reply message.
Sorry for my way of asking questions. Thanks in Advance
I am creating a program that asks the user something like "How are you doing today":
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
Message message = Message.creator(new PhoneNumber("+000000"), // To
// number
new PhoneNumber("0000000"), // From number
"How are you doing today?" // SMS body
).create();
System.out.println(message.getSid());
And then then the program will listen for whatever response the user texts back from their phone.
Now, Twilio says this about receiving SMS:
You can associate that phone number with an SMS URL. When someone sends a text message to that phone number, Twilio makes an HTTP request to your URL with the body of the message and the sender's phone number. You can then respond to the SMS by returning a reply message in the HTTP response to Twilio.
Now, I understand that when the user texts back, Twilio makes an HTTP request to my program, like so:
However, in the tutorial, they create an HTTP tunnel using ngrok to allow the HTTP request to go through. My application is supposed to be able to run in anyone's computer without prior configuration. How would you recommend I achieve this?
I'm afraid that without exposing your application to the Net you won't be able to use that particular API.
What you can try to do instead is polling / fetching:
When you send an SMS or MMS message via the REST API, using the
<Message> verb in TwiML, or someone sends a message to one of your
Twilio numbers Twilio creates a Message instance resource. The
Messages list resource represents the set of messages sent from and
received by an account.
Retrieving sent and received messages from history can be achieved by
querying the Messages list resource.
A short example to start with is available here.
I'm using Javamail to connect to an AWS email service; I've tested that I can receive emails using this code, but I would also like to get a response with data about the sent email, such as the Message ID, which AWS uses to uniquely identify a message.
I'm using MimeMessage to create an email and I am sending it with this code within a try catch block:
transport.sendMessage(message, message.getAllRecipients)
This code just fires off an email to the AWS server and I can't get any metadata back. Is there a way to listen for a response to see if the message was successful so I can retrieve the Message ID?
If the sendMessage method returns, the server accepted the message. Note that that doesn't necessarily mean it will be delivered to the recipient, however. But at that point you can use the getMessageID method to retrieve the message ID.
If the send method throws an exception, the server refused to accept the message for some reason and it won't be sent.
add properties mail.smtp.reportsuccess and mail.smtp.sendpartial to you java Mail Properties, you will get SMTPAddressSucceededException if send email success or SMTPAddressFailedException in fail.
javamail doc
I am using the Twilio java wrapper provided on the website and started making some tests. I am able to send text messages that are successfully received. However, I would like to make sure that the messages have been sent successfully and that no problem has been encountered by Twilio (bad phone number or whatever reason).
I understand that when you make a REST request to Twilio to send a SMS, Twilio responds with the Status. How could I get this response?
Here is the explanation page I found: http://www.twilio.com/docs/howto/sms-notifications-and-alerts
If you specify a StatusCallback URL when you make the request to send an SMS, we will make a request to the callback URL you provided after the message has finished processing, with the parameters either SmsStatus=sent or SmsStatus=failed. You can use this information to do more processing on the SMS message. There's more information here: http://www.twilio.com/docs/api/rest/sending-sms#post-parameters-optional
Alternately, if you hang on to the SMS Message Sid, you should be able to query the API for the message and get the status in the response. So if the sid is SM123, making a GET request to https://api.twilio.com/2010-04-01/Accounts/AC123/SMS/Messages/SM123.json should return a object with the status of the SMS Message.
I recall that the response comes to your url and can be matched up by an ID. In the REST post to SMSMessages you can specify a statuscallback url where Twilio will post a status message to your url.
When you receive that post to your site, you can record it or take any other action you need, such as retrying or using another mode of communication.
In 2020, with the Java SDK, you can now create a MessageFetcher with that SID and then call fetch to ask for the Message instance until its getStatus returns "delivered", "undelivered", or "failed".