Skip to main content

Instant callback

Updated over a month ago

The Instant Callback functionality enables your AI Employee to perform immediate outreach to users who have just submitted a form on your website. This allows for real-time engagement by automatically contacting users via SMS, email, phone calls, or scheduling meetings based on their form inputs.

How It Works

When a user submits a form on your website, an HTTP POST request is triggered (set up on your website backend). This request contains a pre-configured webhook URL with a JSON payload containing the requested action in an arguments array. The AI Employee then initiates the appropriate communication channel without delay.

Finding Your Webhook URL

  1. In the Builder, navigate to the Integrations page.

  2. Click the three dots icon next to the webhook connector and select Webhooks.

  3. On the Incoming tab, look for the webhooh named outbound_call_webhook.

  4. Copy the URL displayed (e.g., https://hooks.newo.ai/mymRK1OWwNu7D0hABqB24g). This is the URL you'll use in your form submissions.

HTML Form Implementation

You can implement Instant Callback using a simple HTML form where the user's contact information is dynamically inserted into the request:

Example HTML Form

<form action="https://your-webhook-url.com" method="POST">
<div>
<label for="name">Your Name:</label>
<input type="text" id="name" name="name" required>
</div>
<div>
<label for="phone">Phone Number:</label>
<input type="tel" id="phone" name="phone" required>
</div>
<input type="hidden" id="requestBody" name="arguments">
<button type="submit" onclick="setRequestValue()">Submit</button>

<script>
function setRequestValue() {
const phone = document.getElementById('phone').value;
const name = document.getElementById('name').value;
const requestBody = {
arguments: [
{
name: "content",
value: `Send an SMS with the following content: Hi ${name}! I'm Adrian, an AI consultant from Newo. Congratulations on your submission!. To the phone number: ${phone}`
},
{
name: "taskTypes",
value: '["send_sms"]'
}
]
};
document.getElementById('requestBody').value = JSON.stringify(requestBody);
}
</script>
</form>

For more control over JSON payloads, use JavaScript to handle the form submission:

document.getElementById('callbackForm').addEventListener('submit', function(event) {
event.preventDefault();

// Get the user's input values from the form
const formData = new FormData(this);
const phone = formData.get('phone');
const email = formData.get('email');
const name = formData.get('name');

// Construct the request with the dynamic user data
fetch('https://your-webhook-url.com', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
arguments: [
{
name: "content",
value: `Send an SMS with the following content: Hi ${name}! I'm Adrian, an AI consultant from Newo. Congratulations on your submission!. To the phone number: ${phone}`
},
{
name: "taskTypes",
value: '["send_sms"]'
}
]
})
});
});

Available Commands

Send SMS

Use this command to have your AI Employee send text messages to users immediately after form submission. The phone number is dynamically filled from the form input:

{
"arguments": [
{
"name": "content",
"value": "Send an SMS with the following content: Hi! I'm Adrian, an AI consultant from Newo. Congratulations, you've just created your AI Employee! To complete the setup, you'll need to meet with my human colleague. Would tomorrow be convenient for you?. To the phone number: 38669699067"
},
{
"name": "taskTypes",
"value": "[\"send_sms\"]"
}
]
}

Send Email

Use this command to have your AI Employee send emails to users instantly. The email address is dynamically filled from the form input:

{
"arguments": [
{
"name": "content",
"value": "Send an email with the following content: Hi! I'm Adrian, an AI consultant from Newo. Congratulations, you've just created your AI Employee!. To the email: [email protected]"
},
{
"name": "taskTypes",
"value": "[\"send_email\"]"
}
]
}

Make Phone Call

Use this command to have your AI Employee call users directly after they submit the form. The phone number is dynamically filled from the form input:

{
"arguments": [
{
"name": "content",
"value": "Call the user at 38669699067. During conversation follow the food order scenario."
},
{
"name": "taskTypes",
"value": "[\"make_call\"]"
}
]
}

Create Meeting

Use this command to have your AI Employee schedule meetings with users automatically. The email address is dynamically filled from the form input:

{
"arguments": [
{
"name": "content",
"value": "Create a meeting with the user on 04.03.2025 at 2 pm using their email [email protected]"
},
{
"name": "taskTypes",
"value": "[\"send_email\"]"
}
]
}

Technical Implementation

Make an HTTP request to your webhook URL with the following specifications:

  • Method: POST

  • Headers:

    • Content-Type: application/json

    • Body: One of the JSON objects containing the argument array with dynamic values from your form.

Did this answer your question?