Hi,
We want to use SMS to send personal questionnaire links to our participants. I use External link module for this (script below). For some reason, when adding personal link, the section sends out two SMS-s instead of one.
The link in the first SMS takes participant to the formr homepage (not the questionnaire). When the second SMS comes through (in 10-20 seconds), then the link in both SMS-s takes participant to the personal questionnaire. (so, in a way, it works, but causes a lot of confusion with the two SMS-s and one temporarily not working properly).
When I replace the SMS text with just "Hello world!" instead of personal link, it sends out one SMS.
So, something happens regarding the study link/personal link causing send-out of 2 SMS-s. According to the local provider we are not exceeding the character limit
of SMS (although the personal link is long, it does not exceed 160 chars, and no special characters are used).
Any tips what might be the cause of the problem?
The function used in External link module is following:
library(httr)
text_message_directmessenger = function(Sender, Receiver, Smstext, Token, return_result = F) {
request = httr::POST("
https://api.messenger.ee/api",
httr::add_headers(`Content-Type` = "application/json", accept = "application/json"),
body = paste0("{
\"api_token\":\"", Token, "\",
\"smstext\":\"", Smstext, "\",
\"receiver\":\"", Receiver, "\",
\"sender\":\"", Sender, "\"
}")
)
response = httr::content(request)
if (return_result) {
response
} else {
if (request$status_code < 300) {
TRUE
} else {
FALSE
}
}
}
text_message_directmessenger(Sender="Institute", Receiver = paste0("372",consent$subj_mobile, sep=""), Smstext = paste0("
http://carotest4.formr.org/?code=", survey_run_sessions$session), Token = "TokenTokenToken", return_result = F)
All the best,
Carolina