How to send user's mail address from React app to ...
# support
u
I have created a React app which utilizes Vapi for the voice assitant feature. I have also setup end of the call analysis to generate a report of the call. I want to send this report to the server url of Make.com where I have setup a system to send mail. How can I send the user's mail from my React app to the server url of the Make via Vapi?
v
@utkarsh To send the user's email from your React app to the server URL of Make.com via VAPI, you'll need to follow these steps: 1. **Collect User's Email**: Ensure that your React app has a form or a method to collect the user's email address. 2. **Generate the Report**: After the end of the call, generate the report as you have set up in your app. 3. **Send Data to Your Endpoint**: Make a POST request from your React app to the endpoint you've created on your server, including the user's email and the report in the request body. 4. **Forward to Make.com**: Your server endpoint should then forward this data to the Make.com server URL. This can be done by making another POST request from your server to the Make.com URL with the necessary data. Here's a simplified example of how you might implement the POST request in your React app using the
fetch
API:
Copy code
javascript
function sendReportToServer(email, report) {
  const endpoint = 'YOUR_SERVER_ENDPOINT_URL'; // Replace with your server endpoint URL
  const data = {
    email: email,
    report: report,
  };

  fetch(endpoint, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(data),
  })
  .then(response => response.json())
  .then(data => {
    console.log('Success:', data);
  })
  .catch((error) => {
    console.error('Error:', error);
  });
}
In this function, replace
'YOUR_SERVER_ENDPOINT_URL'
with the URL of the endpoint on your server that's set up to receive the data and forward it to Make.com. Remember to handle the response and any potential errors appropriately. Also, ensure that your server-side code is prepared to receive the JSON data and make the subsequent POST request to Make.com with the correct parameters they require. If you need any further assistance with the specifics of VAPI or the server-side implementation, please let me know!
You can continue this conversation by mentioning me in the message.
u
Is there any way for Vapi to send this mail to Make.com?
how to add extract structured data?
s
@utkarsh you cannot directly send email using VAPI instead you have to use your server or make to sent end of call report further. The flow will be:
Copy code
You -> Create Call -> In Progress Call -> Call Terminates -> Vapi Sends End of Call Report To Your Server -> Your Server Sends the Email To User
5 Views