--- title: "MOGLI - Opt-Out Automation" slug: "opt-out-automation" updated: 2025-11-21T19:48:57Z published: 2025-11-21T19:48:57Z canonical: "guide.mogli.com/opt-out-automation" --- > ## Documentation Index > Fetch the complete documentation index at: https://guide.mogli.com/llms.txt > Use this file to discover all available pages before exploring further. # Opt-Out Automation ## ### **Build in Flow** 1. From **Setup****,** search and select **Flows.** 2. Click **New.** Choose **Record-Triggered.** 3. Select **Mogli Message** as the Object and trigger the Flow when **a** **record is created or edited**. - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/Screenshot%202025-11-21%20at%202.42.32%E2%80%AFPM.png) - 4. Add custom conditions for **D****irection = Incoming,** and **C****ontact or Lead is not null**. ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-qyy5by7f.png) 5. Drag a **Decision element** onto the canvas. Label it *"SMS Preference."* - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-wcxiiavg.png) 6. Label the first outcome *"Opt Out."* Change the conditions to **Any Conditions is Met (OR)**. Populate resource as **$Record > Message.** Populate the opt-out keywords in the values. - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-6d58j629.png) 7. Add another outcome and label it *"Opt-In."* - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-mcwr3r8d.png) 8. Choose **Any Condition is Met (OR)**. Populate the resource as **$Record > Message**. Populate your opt-in keywords in the values. Click **Done**. - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-kyow8f8t.png) 9. In the **Manager tab**, click **New Resource**. Select **Variable** as the Resource Type. Select **Boolean** as the Data Type. - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-hfjn8aum.png) 10. Drag a new **A****ssignment element** onto the canvas. Label it *“Assign SMS Preference Value as FALSE.”* Populate the variable and assign it the boolean value of **False**. - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/Screenshot%202023-12-08%20at%2012.42.07%20PM.png) 11. Drag a new **A****ssignment element** onto the canvas. Label it *“Assign SMS Preference Value as TRUE.”* Populate the variable and assign it the boolean value of **True.** - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/Screenshot%202023-12-08%20at%2012.42.31%20PM.png) 12. Drag a **Decision element** onto the canvas. Label the decision *“Which object?”* Label the first outcome *“Contact.”* Populate **$Record > Contact** into the Resource field. Set the Operator to **Is Null** and the Value to **False**. - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-qt6nyaee.png) 13. Create a second **outcome**. Label it *“Lead.”* Populate **$Record > Lead** into the Resource field. Set the Operator to **Is Null** and the Value to **False**. Click **Done.** - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-4dsndfqk.png) 14. Drag an **Update Record element** onto the canvas. Label it *“Update Lead.”* Choose to specify conditions to **identify records** and set fields individually. - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-2f4l6t5s.png) 15. Choose **Lead** as the object. Populate the filter requirements as **Id EQUALS $Record > Lead > Lead ID**. Set the record values to have the **Mogli Opt Out field equal to the value of the preference variable**. ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-r14opezs.png) 16. Drag an **Update Record element** onto the canvas. Label it *“**Update Contact.”* Choose to specify conditions to **identify records** and set fields individually. - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-z8ul6nrf.png) 17. Choose **Contact** as the object. Populate the filter requirements as **Id EQUALS $Record > Contact > Contact ID**. Set the record values to have the **Mogli Opt Out field equal to the value of the preference variable**. - ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-5jqtur92.png) 18. Connect the nodes with each decision pointing to the appropriate next element. Note: If their preference is to opt out of messages, then point that decision to the assignment element that updates their preference to **TRUE**. Save and **Activate**. ![](https://cdn.document360.io/aabde203-b6df-4543-b557-999d7d8b937a/Images/Documentation/mogli---opt-out-automation-image-rnn6c8v3.png) **Let's Test the Automation:** 1. Create a test Contact or Lead for yourself (if you haven’t already). 2. Be sure that your Mogli Number is correctly populated. 3. Text in one of your specified Opt-Out keywords to one of your Gateways. 4. The Mogli Opt-Out checkbox should be checked, and the Conversation View should be greyed out. 5. Text in one of your specified Opt-In keywords to that same Gateway. 6. The Mogli Opt-Out checkbox should be unchecked, and the Conversation View should be enabled. **ADMIN TIP**: Depending upon the version of Mogli you’re running (4.2 and under), you may need to allow 5-10 minutes for the Mogli Opt-Out Automation to take effect. The Process will run at the rate of your batch process, which runs anywhere from 5-10 minutes. To see how often your batch process runs, go to **Setup > Scheduled Jobs**. To modify your batch process, go to the **Mogli Settings** tab, under **Utilities****,** adjust the settings for the **Mogli Scheduled Apex Jobs****.**