I Need to forward voicemails to Salesforce (email-to-Case) from Twilio. Currently using Studio and Twiml to execute my work flow.
There is a blog post the demonstrates how this could be done but it does not seem to work as expected.
https://support.twilio.com/hc/en-us/articles/223132287-Forwarding-Recordings-to-Your-Email
I've created and host the php file in Twilio, created a test studio flow that fire a webhook to the host url. Result - i'm able to make a call, record the voicemail but then it gives me an error and then ends the call. no email received.
``<?php
/**
* This section ensures that Twilio gets a response.
*/
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response></Response>'; // Place the desired response (if any) here.
/**
* This section actually sends the email.
*/
/* Your email address. */
$to = "your-email@example.com";
$subject = "Message from {$_REQUEST['From']}";
$message = "You have received a message from {$_REQUEST['From']}.";
$message .= "To listen to this message, please visit this URL: {$_REQUEST['RecordingUrl']}";
$headers = "From: webmaster@example.com"; // Who should it come from?
mail($to, $subject, $message, $headers);``
receive an email in my mailbox as a test