Flireo’s Inject Message API enables advanced workflows where you can send messages into an active AI conversation—allowing the agent to incorporate information that’s often hard to capture, like email addresses, phone numbers, or street names. The injected message becomes part of the conversation context, and the agent may respond to it, reference it, or act on it. This page explains how to use custom tools/functions to trigger this API as part of your agent workflow.
How It Works#
1.
Add a Custom Tool to Your Agent
In your agent's configuration, define a tool/function (e.g., ask_email) that triggers a request to your server.
2.
Agent Calls the Tool
When the AI needs to collect information (like an email address), it calls your tool. You receive a tool-calls event with the following payload:{
"eventTime": 1756278882619,
"callId": "875573b5-4458-45be-bac2-4d2b869f8267",
"eventType": "tool-calls",
"fromCaller": "+31601234567",
"toAssistant": "+31850123456",
"tasksInitiated": [
{
"taskId": "call_kLsrD3eFvY6bko67BqTb7iXc",
"taskName": "ask_email"
}
],
"userMetadata": null
}
3.
Trigger Your Own Workflow
Your external server receives the request and can now run any workflow—such as sending an SMS or WhatsApp message to the user asking for their email address.
4.
User Replies Outside of the Call
The user responds to your SMS/WhatsApp with their email address (or other info).
5.
Inject the Message Into the Live Conversation
Your workflow is triggered by the user's reply. Now use the Inject Message API to push the message directly into the ongoing call:The agent will receive this message as part of the conversation context and can use it naturally in its replies.
Example Use Cases#
Collecting Email Addresses:
If speech recognition struggles with email addresses, send an SMS/WhatsApp to collect it, then inject it for the agent.
Verifying Callers:
Ask users to reply to an SMS to prove they have access to their phone number, and inject that information for the agent to confirm their identity.
Collecting Street Names or Postal Codes:
Use this workflow for any data that’s hard for speech-to-text to accurately capture.
Why Use This API?#
Improved Accuracy:
Avoid speech recognition errors for tricky information.
Seamless Experience:
The user can provide info via SMS/WhatsApp, and the agent instantly continues the conversation with the correct data.
Flexible Workflows:
Build custom verification, onboarding, or data collection flows that bridge channels (call + messaging).
Technical Details#
The call_id is provided in every tool-calls event—use this to inject messages into the correct live call.
Only works for active calls—messages are immediately available to the agent in the conversation context.
Best Practices#
Use this feature to supplement conversational flows, not to interrupt natural dialogue.
Always validate sensitive information before injecting it into the call.
Log injected messages for compliance and troubleshooting.
Modified at 2025-09-08 11:55:35