requestAgent
The requestAgent function starts the call automatically.
Documentation for F2FSDK.requestAgent("workflow_id")
Overview
The F2FSDK.requestAgent("workflow_id")
function allows visitors on your website to directly request assistance from an agent. By providing the unique workflow ID of a popup workflow created in the F2F dashboard, you can seamlessly integrate this functionality into your website.
Prerequisites
- Popup Workflow ID: You need to acquire the unique ID of a popup workflow. This ID can be found in the F2F dashboard under the Workflows section in the sidebar.
- Integration: Ensure that the F2F SDK is properly integrated into your website.
Steps to Use
- Create or Locate a Popup Workflow:
- Navigate to the Workflows section in the F2F dashboard.
- Create a new workflow (or use an existing one) and ensure it is configured as a "Visitor Popup."
- Copy the unique
workflow_id
from the workflow details.
- Implement the Function:
- Use the following custom JavaScript snippet on your website to enable visitors to request an agent:
// Replace 'your_workflow_id' with the actual ID of your popup workflow
F2FSDK.requestAgent("your_workflow_id");
- Trigger the Request:
- Attach the function to a button or an event on your website to allow visitors to request assistance. For example:
<button onclick="F2FSDK.requestAgent('your_workflow_id')">Request Assistance</button>
Example Use Case
Imagine you want visitors to request help while browsing a product page. You can create a button labeled "Need Help?" and link it to the requestAgent
function. When clicked, the configured popup from the workflow will appear, allowing visitors to initiate a conversation with an agent.
Code Example:
<!-- HTML Button -->
<button id="help-button">Need Help?</button>
<!-- JavaScript -->
<script>
document.getElementById("help-button").addEventListener("click", function() {
F2FSDK.requestAgent("your_workflow_id");
});
</script>
Notes
- Ensure the
workflow_id
corresponds to a valid and active popup workflow.
- Any changes to the workflow in the F2F dashboard (e.g., updates to the popup message or agent configuration) will automatically reflect when the function is called.
By following these steps, you can effectively enable visitors to request assistance from an agent with just a single click.
Last updated on December 23, 2024