【发布时间】:2017-10-24 13:29:10
【问题描述】:
尝试在 Java 中使用 Twilio 发送 SMS。
使用com.twilio.sdk:twilio:7.+ 版本。
邮件正文:
You have a new lead - Move 100088
Name: Amruth
Phone number: 07712345678
Move type: OFFICE
Move date: 24 October 2017, 06:33 PM
Moving from: BA1 3AW
Moving to: Bristol Street, Costa Mesa, CA, United States
Please login to your buzzmovePRO account to see details of this lead.
这是我的代码:
Twilio.init(ProjectConfig.TWILIO_ACCOUNT_SID, ProjectConfig.TWILIO_AUTH_TOKEN);
Message message = Message.creator(
new PhoneNumber("+447....988"),//Valid UK NO
new PhoneNumber("+441....57502"), //Valid UK NO
twilioMessage //Body is equal to above text
).create();
但低于错误,但我使用有效的ACCOUNT SID 和AUTH TOKEN
Instantiation of [simple type, class com.twilio.rest.api.v2010.account.Message] value failed: org.joda.time.DateTime.parse(Ljava/lang/String;Lorg/joda/time/format/DateTimeFormatter;)Lorg/joda/time/DateTime;
您的帮助将不胜感激。
【问题讨论】:
-
你是如何分配邮件正文的?您是否以某种方式解析日期,因为这似乎是错误所指的内容。
-
感谢您的评论 @Andy,通过在 gradle 文件
compile group: 'joda-time', name: 'joda-time', version: '2.3'中添加依赖项解决了问题,这在 Twilio 文档中未提及。
标签: java twilio twilio-api