hi friends,
does anyone has any experience with Twilio or any other kind of SMS API's ?
i'm trying to figure how to pass a "new line" to the api
already tried \n and '0A'x ... it just pass then as plain text and not as special characters
proc http
method=POST
url="&url"
in = form (
"From" ="&from"
"To" ="&to"
"Body" ="&sms_body"
)
out=rrespons
headerout=hdrout
WEBUSERNAME="&sid_account"
WEBpassword="&token"
auth_basic
;
DEBUG LEVEL=3 REQUEST_BODY REQUEST_HEADERS;
run;
I think i found the solution..
the problem was that sas tries to url encode the already url encoded character.
the solution is to selectively pre urlencode
data _null_;
length msg_txt $ 256;
msg_txt = urlencode("Go to") || '%0A' || urlencode("New Line");
/* or even shorter ...*/
msg_txt = urlencode("Go to" || byte(10) || "New Line");
call symput('msg_txt', msg_txt);
run;
%put &msg_txt;
combined with using the proc http NOENCODE option
proc http
method=POST
url="&url"
in = form (
"From" ="&from"
"To" ="&to"
noencode "Body" ="&msg_txt"
)
;
run;
Hello Assaf,
didn't work with Twilio myself but according to this:
you need to add a $ sign to the beginning of the message to have your special characters to work.
Hagay
hi hagay,
using $ sign is for cUrl..
i guess i'm looking for the sas equivalent for protecting special characters in proc http
I think i found the solution..
the problem was that sas tries to url encode the already url encoded character.
the solution is to selectively pre urlencode
data _null_;
length msg_txt $ 256;
msg_txt = urlencode("Go to") || '%0A' || urlencode("New Line");
/* or even shorter ...*/
msg_txt = urlencode("Go to" || byte(10) || "New Line");
call symput('msg_txt', msg_txt);
run;
%put &msg_txt;
combined with using the proc http NOENCODE option
proc http
method=POST
url="&url"
in = form (
"From" ="&from"
"To" ="&to"
noencode "Body" ="&msg_txt"
)
;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!