Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit c6ab5b0

Browse files
author
Sarah Stringer
committed
Add two more VirtualAgent examples.
One for changing an agent's language, and one for turning on Sentiment Analysis.
1 parent 6e035d1 commit c6ab5b0

22 files changed

+235
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"title": "Change the Dialogflow ES language",
3+
"type": "server"
4+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Response>
2+
<Connect>
3+
<VirtualAgent connectorName="project" language="fr"/>
4+
</Connect>
5+
</Response>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2+
3+
const response = new VoiceResponse();
4+
const connect = response.connect();
5+
connect.virtualAgent({
6+
connectorName: 'project',
7+
language: 'fr'
8+
});
9+
10+
console.log(response.toString());
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using Twilio.TwiML;
3+
using Twilio.TwiML.Voice;
4+
5+
6+
class Example
7+
{
8+
static void Main()
9+
{
10+
var response = new VoiceResponse();
11+
var connect = new Connect();
12+
connect.VirtualAgent(connectorName: "project", language: "fr");
13+
response.Append(connect);
14+
15+
Console.WriteLine(response.ToString());
16+
}
17+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
require_once './vendor/autoload.php';
3+
use Twilio\TwiML\VoiceResponse;
4+
5+
$response = new VoiceResponse();
6+
$connect = $response->connect();
7+
$connect->virtualagent(['connectorName' => 'project', 'language' => 'fr']);
8+
9+
echo $response;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require 'twilio-ruby'
2+
3+
response = Twilio::TwiML::VoiceResponse.new
4+
response.connect do |connect|
5+
connect.virtual_agent(connector_name: 'project', language: 'fr')
6+
end
7+
8+
puts response
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from twilio.twiml.voice_response import Connect, VoiceResponse, VirtualAgent
2+
3+
response = VoiceResponse()
4+
connect = Connect()
5+
connect.virtualagent(connector_name='project', language='fr')
6+
response.append(connect)
7+
8+
print(response)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import com.twilio.twiml.voice.Connect;
2+
import com.twilio.twiml.VoiceResponse;
3+
import com.twilio.twiml.voice.VirtualAgent;
4+
import com.twilio.twiml.TwiMLException;
5+
6+
7+
public class Example {
8+
public static void main(String[] args) {
9+
VirtualAgent virtualagent = new VirtualAgent.Builder().connectorName("project").language("fr").build();
10+
Connect connect = new Connect.Builder().virtualAgent(virtualagent).build();
11+
VoiceResponse response = new VoiceResponse.Builder().connect(connect).build();
12+
13+
try {
14+
System.out.println(response.toXml());
15+
} catch (TwiMLException e) {
16+
e.printStackTrace();
17+
}
18+
}
19+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2+
3+
const response = new VoiceResponse();
4+
const connect = response.connect({
5+
action: 'https://myactionurl.com/twiml'
6+
});
7+
connect.virtualAgent({
8+
connectorName: 'project',
9+
statusCallback: 'https://mycallbackurl.com'
10+
});
11+
12+
console.log(response.toString());
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using Twilio.TwiML;
3+
using Twilio.TwiML.Voice;
4+
5+
6+
class Example
7+
{
8+
static void Main()
9+
{
10+
var response = new VoiceResponse();
11+
var connect = new Connect(action: new Uri("https://myactionurl.com/twiml"));
12+
connect.VirtualAgent(connectorName: "project", statusCallback: "https://mycallbackurl.com");
13+
response.Append(connect);
14+
15+
Console.WriteLine(response.ToString());
16+
}
17+
}

0 commit comments

Comments
 (0)