This repository was archived by the owner on May 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.java
More file actions
executable file
·37 lines (30 loc) · 1.53 KB
/
Example.java
File metadata and controls
executable file
·37 lines (30 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
=======================================================================
File: Example.java
Created: 2010-01-10
Author: MessageBird B.V.
Version: v1.1 - 2010-07-09
For more information visit http://www.messagebird.com/content/api
This class requires that you have JDK 5 or higher installed.
========================================================================
*/
import com.messagebird.MessageBirdApi;
/**
* This is en example script to show how to use our API with Java.
*/
public class Example {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception {
MessageBirdApi smsApi = new MessageBirdApi();
smsApi.authenticate("username", "password"); //authenticate with MessageBird SMS API
smsApi.setSender("YourSender"); //set the name or number from where the message come from
smsApi.addDestination("31600000001"); //add number to destination list, this function can be called multiple times for more receivers
smsApi.setReference("123456789"); //your unique reference
//smsApi.setTimestamp(2012, 2, 27, 11, 30); //only use if you want to schedule message
smsApi.send("This is a test message"); //send the message to the receiver(s)
System.out.println(smsApi.getResponseCode()); //print out the response code
System.out.println(smsApi.getResponseMessage()); //print out the response message
}
}