--- title: "How to configure Web to Lead Calling" slug: "how-to-configure-web-2-lead-calling" updated: 2026-05-06T13:37:06Z published: 2026-05-06T13:37:06Z canonical: "docs.natterbox.com/how-to-configure-web-2-lead-calling" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.natterbox.com/llms.txt > Use this file to discover all available pages before exploring further. # How to configure Web to Lead Calling > [!NOTE] > This guide is intended for [advanced Salesforce admins](/v1/docs/advanced-salesforce-integration-examples). For Salesforce education, contact Salesforce directly or use trailheads for specific knowledge. > [!WARNING] > *Disclaimer:* > > Web-to-Lead and Flow Builder are native Salesforce functionalities. While this guide provides a baseline template for integrating these features with Natterbox, the setup, customization, and ongoing maintenance of the HTML form and Salesforce architecture remain the responsibility of your organization, not Natterbox. > [!NOTE] > 💡**This solution isn't just for Web2Lead 💡** > > **While this guide uses Web2Lead as the worked example, the same configuration can be applied to any Salesforce record event where you need to trigger an immediate, one-off outbound call.** > > The steps below are fully reusable — just change the triggering object, the entry criteria, and the phone field being dialed. > > **Good candidates for this solution:** > > New inbound leads: (The example used in this guide) — connect an Agent within seconds of form submission > > Critical or escalated Cases: Automatically dial an available on-call agent when a high-priority ticket is raised outside of business hours. > > Key Opportunity stage changes: Prompt the sales engineer to call a prospect the moment a deal moves to a pivotal stage > > **When not to use this solution**: > > If your use case involves working through a batch of records (e.g. collections, renewals, campaign follow-ups), consider [Dynamic Dial Lists instead](/v1/docs/dynamic-dial-lists#creating-a-new-dynamic-dial-list). Record-triggered calling is designed for event-driven, time-critical moments — not volume outbound work. **Overview**: This guide outlines a baseline/example configuration for automatically triggering a Natterbox phone call to an available agent whenever a prospect submits a web form. By combining a standard Salesforce HTML Web-to-Lead form, a Salesforce Custom Formula Field to respect business hours, a Salesforce Record-Triggered Flow, and a Natterbox Routing Policy, organizations can ensure web leads receive immediate phone follow-ups without dialing outside of operational hours. ### Phase 1: Build the HTML Web-to-Lead Form The first step is to generate the HTML for your web form so prospects can submit their details. (The form below is purely a baseline/example for the purposes of this guide) As this is a native Salesforce feature any customization/maintenance to the HTML form remain the responsibility of your organization, not Natterbox. 1. Generate your Web-to-Lead HTML within Salesforce (**Setup > Web-to-Lead**). 2. For the purpose of this guide and testing, we set the Return URL (`retURL`) to a generic page (e.g., `http://google.com`) and disable reCAPTCHA. *(Note: In a live environment, the Return URL will often be your website homepage and you will most likely want to enable reCAPTCHA.)* 3. Ensure the form includes basic contact fields, with the **Phone** field being mandatory for the Natterbox call to function. 4. Include a hidden input field to force the `lead_source` to capture as "Web" within the HTML Form. Example HTML Structure that captures (First name, Last Name, Phone, And Email + Our hidden field for Lead Source = Web) ```xml                                Salesforce Web-to-Lead Form                        

Contact Us

       
                                       

               

               

               

               
                ``` ### Phase 2: Create the Business Hours Custom Field To prevent the system from dialing leads in the middle of the night or outside of business hours, create a custom formula field on the Lead object to calculate the next available operational window that reflects your organization's open business hours. 1. > **Note:** You may need to change this formula to reflect your business’s opening hours. This example uses 9:00 AM - 6:00 PM, Monday-Sunday as a baseline. **How this formula works:** 1. Navigate to **Object Manager > Lead > Fields & Relationships** and create a new **Formula** field returning a **DateTime** value. 2. **Field Label:** `Next_Available_Call_Time` 3. **API Name:** `Next_Available_Call_Time__c` 4. Insert the following formula logic to ensure calls only trigger between 09:00 and 18:00. If a lead is submitted before 09:00, it schedules for 09:00 today; if submitted after 18:00, it schedules for 09:00 the following day. - **Before Business Hours (Midnight to 08:59):** If a lead comes in at 3:00 AM, the formula shifts the time forward to exactly 09:00 that same morning. - **After Business Hours (18:00 to 23:59):** If a lead comes in at 8:00 PM, the formula shifts the time forward to 09:00 the next morning. - **During Business Hours (09:00 to 17:59):** If a lead comes in at 2:30 PM, it doesn't meet either of the "outside hours" criteria, so the formula simply returns the exact `CreatedDate` (2:30 PM). **Formula:** ```plaintext IF(  VALUE(MID(TEXT(CreatedDate), 12, 2)) < 9,  DATETIMEVALUE( TEXT(DATEVALUE(CreatedDate)) & " 09:00:00" ),  IF(    VALUE(MID(TEXT(CreatedDate), 12, 2)) >= 18,    DATETIMEVALUE( TEXT(DATEVALUE(CreatedDate) + 1) & " 09:00:00" ),    CreatedDate  ) ) ``` ### Phase 3: Configure the Salesforce Flow Next, build a Salesforce Flow to catch the new lead and trigger the Natterbox routing based on your business hours field. 1. Create a new **Record-Triggered Flow** on the **Lead** object. 2. Set the trigger to fire when **A record is created**. 3. Set the Entry Conditions to **Any Condition is Met (OR)** where Field: `Lead Source` = `Web`. ![](https://cdn.document360.io/c81c490c-daaa-4ebd-a3c3-1a2dee8b7617/Images/Documentation/image(377).png?sv=2026-02-06&spr=https&st=2026-10-12T06%3A08%3A27Z&se=2026-10-12T07%3A08%3A27Z&sr=c&sp=r&sig=Yv5zRmY0ONQLxS6gQpwHWIQb4QesZf07ywXybQU170g%3D) 1. Add a **Scheduled Path** to the Flow. Base the schedule on the `Next_Available_Call_Time__c` custom field you created in Phase 2 so the action waits for business hours. Configure it with the following settings: - **Path Label:** Business Hours Call - **API Name:** Business_Hours_Call - **Time Source:** `Lead: Next_Available_Call_Time__c` *(This tells the Flow which specific date/time field to base its schedule on.)* - **Offset Number:** 0 *(Setting this to zero ensures the Flow executes exactly at the time calculated by your formula, without adding any extra delay.)* - **Offset Options:** Minutes After *(Combined with the zero offset, this simply tells Salesforce to trigger precisely on the minute of your scheduled time.)* ![](https://cdn.document360.io/c81c490c-daaa-4ebd-a3c3-1a2dee8b7617/Images/Documentation/image(378).png?sv=2026-02-06&spr=https&st=2026-10-12T06%3A08%3A27Z&se=2026-10-12T07%3A08%3A27Z&sr=c&sp=r&sig=Yv5zRmY0ONQLxS6gQpwHWIQb4QesZf07ywXybQU170g%3D) 1. Under the scheduled path (e.g., "Business Hours Call"), add an **Apex Action (Natterbox Phone Call)** and set the Input Values(**Called, Caller, Originator Object ID**) with the following: - **Label:** `weblead` - **API Name:** `weblead` - **Called:** `{!$Record.Phone}` - **Caller:** `weblead` - **Originator Object ID:** `{!$Record.Id}` ![](https://cdn.document360.io/c81c490c-daaa-4ebd-a3c3-1a2dee8b7617/Images/Documentation/image(379).png?sv=2026-02-06&spr=https&st=2026-10-12T06%3A08%3A27Z&se=2026-10-12T07%3A08%3A27Z&sr=c&sp=r&sig=Yv5zRmY0ONQLxS6gQpwHWIQb4QesZf07ywXybQU170g%3D) 1. Press Save and Activate the flow. This will complete the flow build and your completed flow should look something like the following: ![](https://cdn.document360.io/c81c490c-daaa-4ebd-a3c3-1a2dee8b7617/Images/Documentation/image(380).png?sv=2026-02-06&spr=https&st=2026-10-12T06%3A08%3A27Z&se=2026-10-12T07%3A08%3A27Z&sr=c&sp=r&sig=Yv5zRmY0ONQLxS6gQpwHWIQb4QesZf07ywXybQU170g%3D) ### Phase 4: Set Up the Natterbox Routing Policy Finally, configure what happens when Natterbox receives the triggered call from the Salesforce Flow. 1. Navigate to the **Natterbox Routing Policies** page and create a new policy. 2. **Start Node (Invokable Destination):** Set the entry point to match the **EXACT** Apex Action name from your Flow (e.g., `weblead`). ![](https://cdn.document360.io/c81c490c-daaa-4ebd-a3c3-1a2dee8b7617/Images/Documentation/image(381).png?sv=2026-02-06&spr=https&st=2026-10-12T06%3A08%3A27Z&se=2026-10-12T07%3A08%3A27Z&sr=c&sp=r&sig=Yv5zRmY0ONQLxS6gQpwHWIQb4QesZf07ywXybQU170g%3D) 3. **Query Object (Optional):** Add an action to query the Salesforce Lead object to pull the Lead ID and the prospect's Name. 4. **Whisper Text (Optional):** Use the queried data to configure a Whisper Text action (e.g., "New web lead for [Lead Name]") so the agent knows the context before being connected. 5. **Lead Record Pop (Optional):** Add a screen pop action using the queried Lead ID so the prospect's Salesforce record automatically opens on the agent's screen. 6. **Data Analytics for Lead Owner Association (Optional):** Include a To Policy node for a Data Analytics policy to update the Lead Owner Field with the agent that answers the phone. Please see (Phase 5) below for a detailed breakdown. 7. **Call Queue:** Route the final action to your desired Call Queue for an available agent to answer. 8. **Overview:** ![](https://cdn.document360.io/c81c490c-daaa-4ebd-a3c3-1a2dee8b7617/Images/Documentation/image(382).png?sv=2026-02-06&spr=https&st=2026-10-12T06%3A08%3A27Z&se=2026-10-12T07%3A08%3A27Z&sr=c&sp=r&sig=Yv5zRmY0ONQLxS6gQpwHWIQb4QesZf07ywXybQU170g%3D) ## Phase 5: Lead Owner Association (Data Analytics Policy) - (OPTIONAL) To update the Lead Owner Field with the agent who actually answers the phone, you will need to build a secondary Data Analytics policy. 1. Create a new Natterbox policy. Set the Type to **Data Analytics** and Name this policy "Lead Owner Association" 2. At the beginning of the policy, add a **Script Engine** component with the following Lua script. This will capture the User ID of the agent who answered the call: ```lua local userId = session.expand_macro('$(ConnectedUserId)') if userId == nil or userId == '' then return false else -- Creates Custom Macro for ConnectedUserId: $(Custom_UserQuery) session.set("UserQuery", userId) return true end ``` 3. Next, add a new **Query Object** component. This will be used to pull the Username and Name from the UserID output captured in the script above. Configure with the following settings: - **Record Type:** Natterbox User - **Filter Results:** `External Id` = `$(Custom_UserQuery)` - **Selected Fields:** Name, Salesforce User ![](https://cdn.document360.io/c81c490c-daaa-4ebd-a3c3-1a2dee8b7617/Images/Documentation/image(389).png?sv=2026-02-06&spr=https&st=2026-10-12T06%3A08%3A27Z&se=2026-10-12T07%3A08%3A27Z&sr=c&sp=r&sig=Yv5zRmY0ONQLxS6gQpwHWIQb4QesZf07ywXybQU170g%3D) 1. Finally, add an **Update a Record** component. This will update the Lead Owner Field and assign it to the agent that answered the call. - **Record Type:** Lead - **Record ID:** `$(SForce_MyData.Id)` *(This is the created macro from the Query Object in step 3)*. - **Set Field Values:** `Owner ID` = `$(SForce_MyData.nbavs__User__c)` *(This is the value pulled from the Natterbox User query)*. ![](https://cdn.document360.io/c81c490c-daaa-4ebd-a3c3-1a2dee8b7617/Images/Documentation/image(390).png?sv=2026-02-06&spr=https&st=2026-10-12T06%3A08%3A27Z&se=2026-10-12T07%3A08%3A27Z&sr=c&sp=r&sig=Yv5zRmY0ONQLxS6gQpwHWIQb4QesZf07ywXybQU170g%3D) Your member of staff - someone from your organisation making or receiving a call