line1 %%[ SET @test = '{{{description}}}' ]%% line2 %%= v(@test) =%% still line2 line3 %%[ SET @key = '{{{secret}}}' ]%% %%[ SET @unsubMessages = 'UnsubscribeSMSMessages_DEV' SET @unsubEvents = 'UnsubscribeSMS_DEV' SET @num = concat('+', [MOBILE_NUMBER]) SET @rs = RetrieveSalesforceObjects( 'Contact', 'Id,et4ae5__HasOptedOutOfMobile__c', 'MobilePhone', '=', @num ) SET @count = rowCount(@rs) VAR @response SET @rx = '^\+((?:9[679]\d8[035789]\d|6[789]\d|5[90]\d|42\d|3[578]\d|2[1-689]\d)|9[0-58]|8[1246]|6[0-6]|5[1-8]|4[013-9]|3[0-469]|2[70]|7|1)' SET @prefix = concat('+', RegExMatch(@num, @rx, 1)) IF @count>0 THEN FOR @i = 1 TO @count DO SET @sk = Field(Row(@rs, @i), 'Id') IF Field(Row(@rs, 1), 'et4ae5__HasOptedOutOfMobile__c') == 'false' THEN SET @result = UpdateSingleSalesforceObject('Contact', @sk, 'et4ae5__HasOptedOutOfMobile__c', 'true') IF @result == 0 THEN InsertData( @unsubEvents, 'MobileNumber', @num, 'Message', [MSG(0).NOUNS], 'ContactId', @sk, 'Status', 'Error Updating' ) ELSE InsertData( @unsubEvents, 'MobileNumber', @num, 'Message', [MSG(0).NOUNS], 'ContactId', @sk, 'Status', 'Successfully Unsubscribed' ) ENDIF ELSE InsertData( @unsubEvents, 'MobileNumber', @num, 'Message', [MSG(0).NOUNS], 'ContactId', @sk, 'Status', 'Already Unsubscribed' ) ENDIF NEXT @i SET @msg = Lookup( @unsubMessages, 'Message', 'Prefix', @prefix, 'Type', 'Found' ) IF Length(@msg) == 0 THEN SET @response = 'You have unsubscribed and will no longer receive any messages.|' ELSE SET @response = @msg ENDIF ELSE InsertData( @unsubEvents, 'MobileNumber', @num, 'Message', [MSG(0).NOUNS], 'Status', 'Not Found' ) SET @msg = Lookup( @unsubMessages, 'Message', 'Prefix', @prefix, 'Type', 'NotFound' ) IF Length(@msg) == 0 THEN SET @response = 'Sorry, we could not find you' ELSE SET @response = @msg ENDIF ENDIF ]%% %%=v(@response)=%%