`
sillycat
  • 浏览: 2564483 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Ad Solution SMS(1)Open Source Message Send

 
阅读更多
Ad Solution SMS(1)Open Source Message Send

Clone the Project First
> git clone https://github.com/typpo/textbelt
Check my ENV
> node --version && npm --version
v8.10.0
3.5.2
Directly call their official website
> curl -X POST http://textbelt.com/text -d number=512785xxx -d message="I try this message for free from Textbelt" -d key=7dfdff2fc1c926f2cc92757c7c70c2bbe1175fddclHnjkAvAqpCIBatP8y8sBh8G
{"success":false,"error":"Out of quota","quotaRemaining":0}
Run the Service On my Local
> npm install
Adjust some information in the configuration file
> vi lib/config.js
Start the Service
> node server/app.js

It is not working with an exception
> curl -X POST http://localhost:9090/text -d number=5127xxxxx -d "message=I sent this message for free with my VPS"
{"success":false,"message":"No carrier specified"}

Install the dependency
> sudo apt-get install mutt
Install Redis as well
https://redis.io/topics/quickstart
> wget http://download.redis.io/redis-stable.tar.gz
> tar zxvf redis-stable.tar.gz
> mv redis-stable ~/tool/
> sudo ln -s /home/carl/tool/redis-stable /opt/redis
Not stable, some limitation.
There is a website, ClickSend
https://developers.clicksend.com/guides/
https://developers.clicksend.com/docs/rest/v3/
Another website Twilio
https://www.twilio.com/docs/sms/quickstart/java
I will choose JAVA
> java -version
java version "1.8.0_161"
https://www.twilio.com/docs/libraries/java#using-without-a-build-automation-tool
https://www.twilio.com/docs/sms/quickstart/java?code-sample=code-send-an-sms-using-twilio-with-java&code-language=Java&code-sdk-version=7.x#receive-and-reply-to-inbound-sms-messages
Here is my Sender Testing:
package com.lapro.notificationservice;
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
public class DemoApp {
    // Find your Account Sid and Token at twilio.com/user/account
    public static final String ACCOUNT_SID = "AC23341969xxxxxxxx";
    public static final String AUTH_TOKEN = "cc8c2b0cxxxxxxxxx";
    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Message message = Message.creator(new PhoneNumber("+15127852053"), new PhoneNumber("+17372041315"),
                "Hello from simple example, t1").create();
        System.out.println(message.getSid());
    }
}
Here is my Receiver Test, it is a web hook which accept http request and response.
package com.lapro.notificationservice;
import static spark.Spark.get;
import static spark.Spark.post;
import lombok.extern.slf4j.Slf4j;
//import com.twilio.twiml.MessagingResponse;
//import com.twilio.twiml.messaging.Body;
//import com.twilio.twiml.messaging.Message;
@Slf4j
public class DemoSparkApp {
    public static void main(String[] args) {
        get("/", (req, res) -> "Hello Web");
        post("/sms", (req, res) -> {
            log.info("request is " + req.body());
            System.out.println("request2 is " + req.body());
            //res.type("application/xml");
            //Body body = new Body.Builder("The Robots are coming! Head for the hills!").build();
            //Message sms = new Message.Builder().body(body).build();
            //MessagingResponse twiml = new MessagingResponse.Builder().message(sms).build();
            //return twiml.toXml();
            return null;
            //ToCountry=US&
            //ToState=TX&
            //SmsMessageSid=SMfdbd3309edc31160449ad423f619bdd9&
            //NumMedia=0&
            //ToCity=&
            //FromZip=78705&SmsSid=SMfdbd3309edc31160449ad423f619bdd9&
            //FromState=TX&SmsStatus=received&
            //FromCity=AUSTIN&
            //Body=Hello&
            //FromCountry=US&To=%2B17372041315&ToZip=&NumSegments=1&
            //MessageSid=SMfdbd3309edc31160449ad423f619bdd9&
            //AccountSid=AC23341969f7046783c4bc48f4b449b485&From=%2B15127852053&ApiVersion=2010-04-01
        });
    }
}
And here is the dependency in pom.xml, it is using spark framework (Java WEB Framework)
<?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>
<groupId>com.lapro</groupId>
<artifactId>notification-service</artifactId>
<version>1.0.0</version>
<name>Notification Service</name>
<description>Notification Service SMS</description>
<properties>
<orika.version>1.5.1</orika.version>
</properties>
<dependencies>
<dependency>
<groupId>com.twilio.sdk</groupId>
<artifactId>twilio</artifactId>
<version>7.36.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.6</version>
</dependency>
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.26</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>deployment/release/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
How I test that is I download a ngrok tool
https://dashboard.ngrok.com/auth
> sudo cp ~/Downloads/ngrok /usr/local/bin/
> ngrok authtoken 7AQtga8dF9ppBfSxxxxxxxxxx
> ngrok http 4567
It will start a proxy and I can use that as public URL to configure in twilo
Here is how I configure the WEB Hook
For one number number, [Configure] —> [Messaging]
I put my ngrok URL in Webhook as http://0exxxxxx.ngrok.io/sms

References:
https://www.twilio.com/docs/sms/quickstart/python
https://www.twilio.com/docs/sms/tutorials/how-to-receive-and-reply-java
https://www.nexmo.com/pricing
https://github.com/aaronpk/Google-Voice-PHP-API
https://github.com/aaronpk/Google-Voice-PHP-API/blob/master/GoogleVoice.php
https://stackoverflow.com/questions/1668619/is-there-a-google-voice-api
https://stackoverflow.com/questions/16057903/api-services-for-receiving-sms-text-messaging-online
https://github.com/typpo/textbelt
https://stackoverflow.com/questions/2475658/sms-gateway-in-usa
https://textbelt.com/
https://www.clicksend.com/us/pricing/us/
https://lowendbox.com/blog/how-to-send-sms-messages-from-your-vps-using-textbelt/
分享到:
评论

相关推荐

    Analysis of Open Source Drivers for IEEE 802.11 Wlan

    WLAN驱动程序的设计需要支持多种操作模式,包括自组织网络模式(Ad-Hoc)、基础设施模式(Infrastructure)、网格网络模式(Mesh)、无线分配系统(WDS)、虚拟接入点(Virtual Access Point, VAP)、虚拟接口以及...

    new ADC drivers_between_AD7768sourcecode_ad7768_

    标题中的“new ADC drivers_between_AD7768sourcecode_ad7768_”暗示了这是一个关于新型ADC(Analog-to-Digital Converter)驱动程序的项目,特别关注于AD7768芯片与FPGA(Field-Programmable Gate Array)之间的...

    AD_ad7768_ad7768驱动代码_AD7768-4程序_AD7768-1的FPGA驱动程序

    标题“AD_ad7768_ad7768驱动代码_AD7768-4程序_AD7768-1的FPGA驱动程序”揭示了我们讨论的主题是关于AD7768系列模拟数字转换器(ADC)的驱动程序开发,特别是针对AD7768-1型号的单通道24位版本,以及可能涉及到的AD...

    AD7682.rar_ AD7682_AD7682 source code_ad76_ad7682 spi_ad7689

    A/D模数转换模块源代码,代码使用了8通道一起检测,在AVR单片机上调试成功

    BuggyAutoSAR is an open-source, playful implementation of the Ad

    BuggyAutoSAR is an open-source, playful implementation of the Adaptive AUTOSAR platform.

    stm32+AD9851.rar_AD9851 STM32_STM32 opendds_STM32+AD9851_stm32+A

    开源stm32+AD9851做的DDS,25M带宽

    AD5660 STM32驱动程序

    1. **初始化过程**:在STM32上驱动AD5660的第一步是初始化I2C或SPI接口,因为AD5660支持这两种通信协议。在`AD5660.c`中,会有一个初始化函数,如`AD5660_Init()`, 这个函数通常会配置GPIO引脚、初始化I2C或SPI总线...

    Ad Block plus for Android source code

    Ad Block plus for Android的源码。放在这里分享是因为国外服务器下载比较慢。

    OpenRTB-Native-Ads-Specification-Final-1.2.pdf

    ### OpenRTB动态原生广告API规范版本1.2知识点详解 #### 一、概述 **OpenRTB(Open Real-Time Bidding)**是互联网广告领域内的一种开放式协议标准,旨在促进广告库存的实时竞价过程。它由IAB(Interactive ...

    AD7760_7762_FPGA_Source_Example_code

    《AD7760与AD7762 FPGA设计实例解析》 在现代电子系统设计中,高精度的模拟数字转换器(ADC)扮演着至关重要的角色。AD公司的AD7760和AD7762是两款高性能的模数转换器,广泛应用于医疗设备、工业自动化以及测量系统...

    AD(AD9280)和DA(AD9708) FPGA读写Verilog设计源码Quartus工程文件.zip

    AD(AD9280)和DA(AD9708) FPGA读写Verilog设计源码Quartus工程文件,AD芯片选用AD9280,DA芯片选用AD9708,,FPGA型号Cyclone4E系列中的EP4CE10F17C8,Quartus版本18.0。 module hs_ad_da( input sys_clk , //系统...

    android ad-hoc source code

    在这个场景下,"android ad-hoc source code"可能是指一个针对Android 2.2(Froyo)版本实现的源代码,用于支持或改进设备间的ad-hoc网络连接功能。 Android 2.2 Froyo是Android操作系统的一个重要版本,它在2010年...

    江苏电力Active_Directory_及SMS_2003部署方案

    在信息技术领域,尤其是在企业网络管理中,Active Directory(AD)和Systems Management Server(SMS)是两大关键组件。本方案针对江苏电力公司的网络架构,详细阐述了AD和SMS 2003的部署策略,以实现高效、安全和...

    AD域结合CA与802.1X结合的多个参考文档

    标题中的“AD域结合CA与802.1X结合的多个参考文档”是指将活动目录(Active Directory, AD)与证书颁发机构(Certificate Authority, CA)与802.1X认证技术相结合,用于强化网络访问控制。这种集成方案在企业环境...

    zxl.zip_ad_current source

    "zxl.zip_ad_current source"这个压缩包文件包含了两个关键性的资源:`zxl.PcbLib` 和 `zxl.SchLib`,它们是针对AD(Altium Designer)软件的封装库文件,用于电路板(PCB)和电路原理图(Schematic)的设计。...

    OpenFOAM-v1812-AD:在正向和反向模式下自动区分OpenFOAM源代码

    OpenFOAM-v1812-AD 该存储库包含OpenFOAM-v1812源代码,这些源代码通过正向和反向模式下的自动区分(AD)来区分。安装OpenFOAM-v1812-AD的安装与OpenFOAM-v1812的安装类似。 需要首先安装所有必备组件,获取OpenFOAM...

    ad8232_ad8232stm32_ad8232程序_AD8232_AD8232stm32代

    标题中的“ad8232_ad8232stm32_ad8232程序_AD8232_AD8232stm32代”暗示了我们正在讨论一个基于AD8232心电图(ECG)检测芯片与STM32微控制器的集成应用项目。AD8232是一款高性能、低功耗的心率监测集成电路,适用于...

    AD7192 AD7190 驱动 程序 代码

    在本文中,我们将深入探讨如何使用STM32微控制器通过SPI接口驱动AD7192和AD7190模数转换器(ADC)。这两个器件是ADI公司出品的高精度、低功耗的24位Σ-Δ型ADC,常用于工业自动化、医疗设备和数据采集系统等应用。 ...

    ad7768中文手册

    为了适应不同的电源设计,AD7768的电源需求灵活,AVDD1为5.0V,AVDD2为2.25V至5.0V,IOVDD为2.5V至3.3V或者1.8V。这样的电源适应性使得AD7768可以在多种不同的系统中使用。 AD7768提供了多种功耗、速度和带宽模式,...

    OMA (Open Mobile Alliance) DRM V2.0 标准

    在Android 3.0之后,系统原生支持OMA DRM 1.0,而2.0版本的实现可以参考AOSP(Android Open Source Project)源代码,这使得开发者和制造商能够为移动设备构建符合标准的DRM解决方案,确保内容的安全性和合法使用。...

Global site tag (gtag.js) - Google Analytics