Schedule an Appointment SMS using SOAP API

SMS Schedule Appointment with Phone Number

%%[
VAR @xml, @rowset, @row, @FamilyTotal, @MessageId, @HOHid, @mobile, @MessageBody

SET @xml = XML_Feed
SET @rowset = BuildRowsetFromXml(@xml, "//Record",1)
SET @FamilyTotal = RowCount(@rowset)

IF NOT Empty(@FamilyTotal) then
SET @row = Row(@rowset,1)
SET @MessageId = Field(@row,"MessageId_att")
SET @HOHid = Field(@row,"HOHID_att")
SET @mobile = Field(@row,"CellPhone_att")
SET @MessageBody = Field(@row,"MessageBody_att")
SET @MessageBody = Replace(Replace(Replace(@MessageBody,"<","<"),">",">"),""","""")
ELSE
RaiseError("Missing subscriber information.",true)
ENDIF

InsertData("SMS_Send_Log","SMS_JOB_ID",SMS_Job_ID, "Phone", @mobile, "SMSSendTime", Now(), "AppointmentID",
"0", "PatientID", "0", "AppointmentDateTime", "1/1/2000", "CampaignName", "0", "PatientFirstName", "",
"AppointmentClinicID", "0", "HOHid", @HOHid, "MessageId", @MessageId)
]%%

%%=v(Substring(@MessageBody,1,160))=%%

SMS Schedule Appointment with Shortened URL

%%[
VAR @xml, @rowset, @row, @FamilyTotal, @MessageId, @HOHid, @mobile, @MessageBody, @MessageGUID,
@LanguageCode, @LangURL, @RescheduleURL, @ShortURL

SET @xml = XML_Feed
SET @rowset = BuildRowsetFromXml(@xml, "//Record",1)
SET @FamilyTotal = RowCount(@rowset)

IF NOT Empty(@FamilyTotal) then
SET @row = Row(@rowset,1)
SET @MessageId = Field(@row,"MessageId_att")
SET @HOHid = Field(@row,"HOHID_att")
SET @mobile = Field(@row,"CellPhone_att")
SET @MessageBody = Field(@row,"MessageBody_att")
SET @MessageBody = Replace(Replace(Replace(@MessageBody,"<","<"),">",">"),""","""")
SET @MessageGUID = Field(@row,"
MessageGUID_att") SET @LanguageCode = Field(@row,"LanguageCode_att")
SET @LangURL = "
X"
ELSE
RaiseError("
Missing subscriber information.",true)
ENDIF

InsertData("
SMS_Send_Log","SMS_JOB_ID",SMS_Job_ID, "Phone", @mobile, "SMSSendTime", Now(),
"
AppointmentID", "0", "PatientID", "0", "AppointmentDateTime", "1/1/2000", "CampaignName", "0",
"
PatientFirstName", "", "AppointmentClinicID", "0", "HOHid", @HOHid, "MessageId", @MessageId)

IF @LanguageCode == 2 THEN
SET @LangURL = "
%2Fes"
ELSE
SET @LangURL = "
"
ENDIF

SET @RescheduleURL = Concat("
https%3A%2F%2Fwww.example.com%2Fl%2Freschedule_appointment",@LangURL,
"
%3F%26guid%3D",@MessageGUID,"%26utm_source%3Dtriggered%26utm_medium%3Dtext%26utm_content%3Dschedule")
SET @ShortURL = HTTPGet(Concat("
http://www.example.com/s?url=",@RescheduleURL))
SET @MessageBody = REPLACE(@MessageBody,"
%ShortURL%",@ShortURL)
]%%

%%=v(Substring(@MessageBody,1,160))=%%