Hello everyone,
I trying to develop some flows, in the begin is very easy but now I would like to improve the difficulty.
I would like to write a VoiceFlow where I can send an SMS. I cannot use IFTTT because does not work.
I get an account in Nexmo where you can start to send some SMS for free. I tried to send SMS by command line and it’s OK.
The code supplied by Nexmo for command line is:
curl -X “POST” “https://rest.nexmo.com/sms/json”
-d “from=3937030#####”
-d “text=Hello world from Nexmo.”
-d “to=3934876#####”
-d “api_key=8da#####”
-d “api_secret=C2Dh59jAJbk#####”
This mode works perfectly.
Now I would like to try with a code block in VoiceFlow.
The code supplied by Nexmo for Javascript is:
The library to install
compile ‘com.nexmo:client:4.+’
The code
NexmoClient client = new NexmoClient.Builder()
.apiKey(“8da#####”)
.apiSecret(“C2Dh59jAJbk#####”)
.build();
String messageText = “Hello world from Nexmo.”;
TextMessage message = new TextMessage(“3937030#####”, “3934876#####”, messageText);
SmsSubmissionResponse response = client.getSmsClient().submitMessage(message);
for (SmsSubmissionResponseMessage responseMessage : response.getMessages()) {
System.out.println(responseMessage);
}
Now, I tried to create a Code block in a Voiceflow, I defined the variables but I always get an error.
Could anyone help me?
Beppe
P.s.: The character ##### to mask my data