I would like to know on how to personalised SMS contents with AMPScript.
I have 2 Data Extensions where one Data extension has member information, and another that's been imported:
- DE with SMS Contents
Happy Birthday
%%=v(@name)=%%
! Kickstart your August Birthday staycation NOW!
I am unable to pull the respective member name with below AMPScript written.
Need some guidance.
%%[
VAR @language, @languages, @smsContent, @name, @names, @BatchSMSList7, @BatchSMSList7Record,@campaigncode, @message, @BatchSMSMessage7, @BatchSMSMessage7Record
Set @name = [cust_name]
Set @names = LookupRows("SCV_SF", "cust_id", cust_id)
IF RowCount(@names) > 0 THEN
Set @nameRecord = Row(@names,1)
Set @name = Field(@nameRecord,"cust_name")
ENDIF
set @language = [language]
IF empty (@language) THEN
Set @language = "EN"
Set @languages = LookupRows("SCV_SF", "cust_id", cust_id)
IF RowCount(@languages) > 0 THEN
Set @langRecord = Row(@languages,1)
Set @language = Field(@langRecord,"language")
ENDIF
ENDIF
Set @BatchSMSList7 = LookupRows("Batch SMS List 7", "cust_id", cust_id)
IF RowCount(@BatchSMSList7) > 0 THEN
Set @BatchSMSList7Record = Row(@BatchSMSList7,1)
Set @campaigncode = Field(@BatchSMSList7Record,"campaign_code")
set @message = Field(@BatchSMSList7Record, "message")
Set @BatchSMSMessage7 = LookupRows("Batch SMS Message 7", "campaign_code", @campaigncode, "message", @message)
Set @BatchSMSMessage7Record = Row(@BatchSMSMessage7,1)
IF @language == "ZH" THEN
Set @smsContent = Field(@BatchSMSMessage7Record,"sms_chi", @name, "cust_name")
ELSE
Set @smsContent = Field(@BatchSMSMessage7Record,"sms_eng", @name, "cust_name")
ENDIF
ENDIF
]%%
%%=v(@smsContent)=%%