Hello guys, sorry for my lateness to write for you, but I’m trying to gain the certificate of CTAL, and I have studied a lot. So, I will show one function to send a skype message in the middle of automation. This is very usefull when occurs some error and you have to send on the exactly moment to some developer or responsible.
First you have to download the lib of skype: skype-java-api-1.4.jar , after creates a class, and after the function.
This is my example of function, you have to installed the skype in the machine that will execute the automation.
Add the people will receive this message. In the skype config permits others application use, maybe you have to execute the first time and after, go to skype and enable the advertisement that will be showed, asking for permission of use skype.
Function:
package Test;
import com.skype.ContactList; // Import the classes of lib.
import com.skype.Friend;
import com.skype.Skype;
import com.skype.SkypeException;
public class MessageSkype_Send {
public static void Errors_Send() throws SkypeException {
try {
ContactList list = Skype.getContactList();
Friend resp = list.getFriend(userIdSkype); // Change the skype name
resp.send(“(*) Error Automation \n“); // This is the message that will be send
} catch (Exception e) {
System.println(e.getMessage());
}
}
}
Hi Rafaela, how are you?
Do you know if exists a way to do the inverse? If a send a message to some user, the api gets this message and do some code?
I see this feature in jenkins, when you send a message to the jenkins user and it starts a build…
Do you know if this api provides this?
Thanks, Gustavo Godoy
Hello Gustavo,
I tested just change the command:
Friend resp = list.getFriend(userIdSkype);
resp.send(“(*) Error Automation \n“);
To:
Friend send = list.getFriend(userIdSkype);
ChatMessage[] AllRecentMessages = send.chat().getRecentChatMessages();
AllRecentMessages[0].getContent();
This command, will bring the message in specific position on array of the recent chat. So you have to make some adjusts to catch only the last message or something like that, because you have to know the position on the array of the message, if you don’t know, maybe you have to search in the array for the message. You can use send.chat().resp.getAllChatMessages() to bring all messages of the chat, but the array will be very extensive.
Don’t forget the import com.skype.ChatMessage;
I hope that I have help you !