JAVA-15787 Created new messaging-modules and saas-modules
- Moved jgroups, rabbitmq, spring-amqp, spring-apache-camel, spring-jms to messaging-modules - Moved twilio, twitter4j, strip to saas-modules - Renamed existing saas to jira-rest-integration
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
## Twilio
|
||||
|
||||
This module contains articles about Twilio
|
||||
|
||||
### Relevant Articles:
|
||||
|
||||
- [Sending SMS in Java with Twilio](https://www.baeldung.com/java-sms-twilio)
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>twilio</artifactId>
|
||||
<name>twilio</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>saas-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.twilio.sdk</groupId>
|
||||
<artifactId>twilio</artifactId>
|
||||
<version>${twilio.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<twilio.version>7.20.0</twilio.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.baeldung.twilio.sms;
|
||||
import com.twilio.Twilio;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
||||
import com.twilio.type.PhoneNumber;
|
||||
|
||||
public class TwilioSmsExample {
|
||||
// Find your Account Sid and Token at twilio.com/console
|
||||
public static final String ACCOUNT_SID = "SID";
|
||||
public static final String AUTH_TOKEN = "AUTH";
|
||||
|
||||
// Create a phone number in the Twilio console
|
||||
public static final String TWILIO_NUMBER = "+12223334444";
|
||||
|
||||
public static void main(String[] args) {
|
||||
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
|
||||
Message message = Message.creator(
|
||||
new PhoneNumber("+17778889999"),
|
||||
new PhoneNumber(TWILIO_NUMBER),
|
||||
"Sample Twilio SMS using Java")
|
||||
.create();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.baeldung.twilio.sms;
|
||||
import com.twilio.Twilio;
|
||||
import com.twilio.converter.Promoter;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
||||
import com.twilio.type.PhoneNumber;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
public class TwilioSmsMediaExample {
|
||||
// Find your Account Sid and Token at twilio.com/console
|
||||
public static final String ACCOUNT_SID = "SID";
|
||||
public static final String AUTH_TOKEN = "AUTH";
|
||||
|
||||
// Create a phone number in the Twilio console
|
||||
public static final String TWILIO_NUMBER = "+12223334444";
|
||||
|
||||
public static void main(String[] args) {
|
||||
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
|
||||
Message message = Message.creator(
|
||||
new PhoneNumber("+17778889999"),
|
||||
new PhoneNumber(TWILIO_NUMBER),
|
||||
"Sample Twilio MMS using Java")
|
||||
.setMediaUrl(
|
||||
Promoter.listOfOne(
|
||||
URI.create("http://www.baeldung.com/wp-content/uploads/2017/10/icon-javaseries-home.png")))
|
||||
.create();
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.baeldung.twilio.sms;
|
||||
import com.google.common.util.concurrent.FutureCallback;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.twilio.Twilio;
|
||||
import com.twilio.base.ResourceSet;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
||||
|
||||
public class TwilioSmsStatusAsyncExample {
|
||||
// Find your Account Sid and Token at twilio.com/console
|
||||
public static final String ACCOUNT_SID = "SID";
|
||||
public static final String AUTH_TOKEN = "AUTH";
|
||||
|
||||
// Create a phone number in the Twilio console
|
||||
public static final String TWILIO_NUMBER = "+12223334444";
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
|
||||
ListenableFuture<ResourceSet<Message>> future = Message.reader().readAsync();
|
||||
Futures.addCallback(
|
||||
future,
|
||||
new FutureCallback<ResourceSet<Message>>() {
|
||||
public void onSuccess(ResourceSet<Message> messages) {
|
||||
for (Message message : messages) {
|
||||
System.out.println(message.getSid() + " : " + message.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
public void onFailure(Throwable t) {
|
||||
System.out.println("Failed to get message status: " + t.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.baeldung.twilio.sms;
|
||||
import com.twilio.Twilio;
|
||||
import com.twilio.base.ResourceSet;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
||||
import com.twilio.type.PhoneNumber;
|
||||
|
||||
public class TwilioSmsStatusExample {
|
||||
// Find your Account Sid and Token at twilio.com/console
|
||||
public static final String ACCOUNT_SID = "SID";
|
||||
public static final String AUTH_TOKEN = "AUTH";
|
||||
|
||||
// Create a phone number in the Twilio console
|
||||
public static final String TWILIO_NUMBER = "+12223334444";
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
|
||||
ResourceSet<Message> messages = Message.reader().read();
|
||||
for (Message message : messages) {
|
||||
System.out.println(message.getSid() + " : " + message.getStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user