Example 5

Top  Previous  Next

Example 5

 

This filter script is designed to work with an SMS Replies system and is configured to look for the words 'subscribe' and 'unsubscribe' in the body of reply messages. If it finds 'subscribe', it reconfigures the message to go to the recipient or group in PageGate named 'subscribe'. If it finds 'unsubscribe', it reconfigures the message to go to the recipient or group named 'unsubscribe'.

 

Note: The <InputFile> and <OutputFile> sections are not icluded, so the script will use the filename passed in by PageGate, and write the script's results back to the same filename when done.

 

Note: Lines prefaced with # are comment lines for description purposes. The filter ignore any lines that begin with #

 

# look for 'unsubscribe' in message text (all lower case)

# if found, route the message to 'unsubscribe' recipient

<Filter>

 <Search>

         <Section>

                 Message

         </Section>

         <Type>

                 Literal

         </Type>

         <Text>

                 unsubscribe

         </Text>

 </Search>

 <Replace>

         <Section>

                 Recipient

         </Section>

         <Scope>

                 Section

         </Scope>

         <Text>

                 unsubscribe-recipient-or-group-here

         </Text>

 </Replace>

 <Continue>

         False

 </Continue>

</Filter>

 

# look for 'Unsubscribe' in message text (begins with capital)

# if found, route the message to 'unsubscribe' recipient

<Filter>

 <Search>

         <Section>

                 Message

         </Section>

         <Type>

                 Literal

         </Type>

         <Text>

                 Unsubscribe

         </Text>

 </Search>

 <Replace>

         <Section>

                 Recipient

         </Section>

         <Scope>

                 Section

         </Scope>

         <Text>

                 unsubscribe-recipient-or-group-here

         </Text>

 </Replace>

 <Continue>

         False

 </Continue>

</Filter>

 

# look for 'subscribe' in message text (all lower case)

# if found, route the message to 'subscribe' recipient

<Filter>

 <Search>

         <Section>

                 Message

         </Section>

         <Type>

                 Literal

         </Type>

         <Text>

                 subscribe

         </Text>

 </Search>

 <Replace>

         <Section>

                 Recipient

         </Section>

         <Scope>

                 Section

         </Scope>

         <Text>

                 subscribe-recipient-or-group-here

         </Text>

 </Replace>

 <Continue>

         False

 </Continue>

</Filter>

 

# look for 'Subscribe' in message text (begins with capital)

# if found, route the message to 'subscribe' recipient

<Filter>

 <Search>

         <Section>

                 Message

         </Section>

         <Type>

                 Literal

         </Type>

         <Text>

                 Subscribe

         </Text>

 </Search>

 <Replace>

         <Section>

                 Recipient

         </Section>

         <Scope>

                 Section

         </Scope>

         <Text>

                 subscribe-recipient-or-group-here

         </Text>

 </Replace>

 <Continue>

         False

 </Continue>

</Filter>