Share Gen AI suggestions with Twilio using SMS
You can share agent assistance suggestions shown to the agent during phone call to a customer.
Twilio provides a REST API to send text messages. You need to use the REST API in your media toolbar application to send the text message.
For this, update sendTextMessage function in your vendorHandler.ts file as shown in the following example:
public async sendTextMessage(suggestionData: IMcaOnToolbarInteractionCommandData, resolveRef: Function): Promise<void> {
var myHeaders = new Headers();
myHeaders.append("Authorization", 'Basic AC8b3a4e9ea72839df7xxxxxx')); // Add your authorization header here
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("To", this.call.parameters.From);
urlencoded.append("From", "+1234567890");// Your TWILIO Number
urlencoded.append("Body", body);
var requestOptions: any = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch(`${VendorHandler.TWILIO_SERVICE}`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
}
Verify your progress
Once you complete these steps, use OJET serve to start you application and sign in to your Fusion application. Open the media toolbar and make your agent available for calls by clicking on the agent availability button. Now, start a call to your customer care number. You'll receive the incoming call notification in your media toolbar application and in your Fusion window. You can accept the call from your media toolbar application or from your Fusion application. Once the conversation is started, you can see the real-time transcripts are getting rendered in the Fusion engagement panel. You'll also see agent assistance suggestions which are shown based on the suggestions. When you go to the drill down view of a particular suggestion, you'll see a share via text message button. Click the button and the suggestion will be shared as a text message to the customer.