Skip to content

Commit ee7ec2b

Browse files
committed
Add sample project
1 parent 3258c5e commit ee7ec2b

File tree

4 files changed

+200
-26
lines changed

4 files changed

+200
-26
lines changed

mint.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"topbarLinks": [
1515
{
1616
"name": "Support",
17-
"url": "mailto:hi@mintlify.com"
17+
"url": "mailto:lars@simli.com"
1818
}
1919
],
2020
"topbarCtaButton": {

preview.gif

3.17 MB
Loading

quickstart.mdx

+182-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ Dialogue that works:
4141

4242
## 3. Creating a session
4343
Get session meeting URL with a simple request like the following Python example:
44-
45-
```python
44+
<CodeGroup>
45+
```python Python
4646
import requests
4747

4848
# API endpoint
@@ -68,6 +68,186 @@ response = requests.post(url, json=payload)
6868

6969
print("Response:", response.json())
7070
```
71+
```javascript Javascript
72+
const fetch = require('node-fetch');
73+
74+
// API endpoint
75+
const url = "https://simli.com/api/startSession";
76+
77+
// Request payload
78+
const payload = {
79+
apiKey: "YOUR_API_KEY",
80+
userName: "Johnny",
81+
characterName: "Jenna",
82+
faceId: "tmp9i8bbq7c",
83+
voiceId: "21m00Tcm4TlvDq8ikWAM",
84+
intro: "Hey, how are you.",
85+
prompt: "Compose dialogue for a character named Jenna, an AI character that has come alive on and is reperesented in visual form as an attractive 40 year old woman. Each of Jenna's responses should start with a short, standalone opening phrase, strictly limited to no more than 4 words.\nThe phrase following this opener should be brief, continuing or initiating a new thought without leading punctuation from the opener. This sentence should be concise, with any additional sentences being slightly longer but not exceeding 10 words, allowing Jenna to humorously interact with the users in the meeting.\n\nRemember, Jenna's dialogue must abide by the format rules in every speaking turn:\n- A short non-content opener, ending with a full stop, exclamation mark, or question mark.\n- The second sentence should be quite short as well, and any additional following sentences can be a bit longer, further developing his point.\n\nInclude an example dialogue to illustrate the expected structure of Jenna's lines. For instance:\n\n'Example of Jenna's dialogue pattern:\nJenna: Hi there What's this? A meeting?\nJenna: Oh hold on let me wait for the next token",
86+
timeLimit: {
87+
limit: 60 // Session limit in seconds
88+
}
89+
};
90+
91+
// Sending POST request
92+
fetch(url, {
93+
method: 'POST',
94+
body: JSON.stringify(payload),
95+
headers: { 'Content-Type': 'application/json' },
96+
})
97+
.then(response => response.json())
98+
.then(data => console.log("Response:", data))
99+
.catch(error => console.error("Error:", error));
100+
```
101+
```java Java
102+
import java.io.BufferedReader;
103+
import java.io.InputStreamReader;
104+
import java.io.OutputStream;
105+
import java.net.HttpURLConnection;
106+
import java.net.URL;
107+
108+
public class Main {
109+
public static void main(String[] args) {
110+
try {
111+
// API endpoint
112+
URL url = new URL("https://simli.com/api/startSession");
113+
114+
// Request payload
115+
String payload = "{\"apiKey\":\"YOUR_API_KEY\",\"userName\":\"Johnny\",\"characterName\":\"Jenna\",\"faceId\":\"tmp9i8bbq7c\",\"voiceId\":\"21m00Tcm4TlvDq8ikWAM\",\"intro\":\"Hey, how are you.\",\"prompt\":\"Compose dialogue for a character named Jenna, an AI character that has come alive on and is reperesented in visual form as an attractive 40 year old woman. Each of Jenna's responses should start with a short, standalone opening phrase, strictly limited to no more than 4 words.\\nThe phrase following this opener should be brief, continuing or initiating a new thought without leading punctuation from the opener. This sentence should be concise, with any additional sentences being slightly longer but not exceeding 10 words, allowing Jenna to humorously interact with the users in the meeting.\\n\\nRemember, Jenna's dialogue must abide by the format rules in every speaking turn:\\n- A short non-content opener, ending with a full stop, exclamation mark, or question mark.\\n- The second sentence should be quite short as well, and any additional following sentences can be a bit longer, further developing his point.\\n\\nInclude an example dialogue to illustrate the expected structure of Jenna's lines. For instance:\\n\\n'Example of Jenna's dialogue pattern:\\nJenna: Hi there What's this? A meeting?\\nJenna: Oh hold on let me wait for the next token\",\"timeLimit\":{\"limit\":60}}";
116+
117+
// Open connection
118+
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
119+
connection.setRequestMethod("POST");
120+
connection.setRequestProperty("Content-Type", "application/json");
121+
connection.setDoOutput(true);
122+
123+
// Send request
124+
OutputStream outputStream = connection.getOutputStream();
125+
outputStream.write(payload.getBytes());
126+
outputStream.flush();
127+
128+
// Get response
129+
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
130+
String inputLine;
131+
StringBuilder response = new StringBuilder();
132+
while ((inputLine = in.readLine()) != null) {
133+
response.append(inputLine);
134+
}
135+
in.close();
136+
137+
// Print response
138+
System.out.println("Response: " + response.toString());
139+
140+
} catch (Exception e) {
141+
e.printStackTrace();
142+
}
143+
}
144+
}
145+
```
146+
```ruby Ruby
147+
require 'net/http'
148+
require 'uri'
149+
require 'json'
150+
151+
# API endpoint
152+
url = URI("https://simli.com/api/startSession")
153+
154+
# Request payload
155+
payload = {
156+
"apiKey": "YOUR_API_KEY",
157+
"userName": "Johnny",
158+
"characterName": "Jenna",
159+
"faceId": "tmp9i8bbq7c",
160+
"voiceId": "21m00Tcm4TlvDq8ikWAM",
161+
"intro": "Hey, how are you.",
162+
"prompt": "Compose dialogue for a character named Jenna, an AI character that has come alive on and is reperesented in visual form as an attractive 40 year old woman. Each of Jenna's responses should start with a short, standalone opening phrase, strictly limited to no more than 4 words.\nThe phrase following this opener should be brief, continuing or initiating a new thought without leading punctuation from the opener. This sentence should be concise, with any additional sentences being slightly longer but not exceeding 10 words, allowing Jenna to humorously interact with the users in the meeting.\n\nRemember, Jenna's dialogue must abide by the format rules in every speaking turn:\n- A short non-content opener, ending with a full stop, exclamation mark, or question mark.\n- The second sentence should be quite short as well, and any additional following sentences can be a bit longer, further developing his point.\n\nInclude an example dialogue to illustrate the expected structure of Jenna's lines. For instance:\n\n'Example of Jenna's dialogue pattern:\nJenna: Hi there What's this? A meeting?\nJenna: Oh hold on let me wait for the next token",
163+
"timeLimit": {
164+
"limit": 60 # Session limit in seconds
165+
},
166+
}
167+
168+
# Sending POST request
169+
http = Net::HTTP.new(url.host, url.port)
170+
http.use_ssl = true
171+
request = Net::HTTP::Post.new(url)
172+
request["Content-Type"] = "application/json"
173+
request.body = payload.to_json
174+
response = http.request(request)
175+
176+
puts "Response: #{response.body}"
177+
178+
```
179+
```php PHP
180+
<?php
181+
182+
// API endpoint
183+
$url = "https://simli.com/api/startSession";
184+
185+
// Request payload
186+
$data = array(
187+
"apiKey" => "YOUR_API_KEY",
188+
"userName" => "Johnny",
189+
"characterName" => "Jenna",
190+
"faceId" => "tmp9i8bbq7c",
191+
"voiceId" => "21m00Tcm4TlvDq8ikWAM",
192+
"intro" => "Hey, how are you.",
193+
"prompt" => "Compose dialogue for a character named Jenna, an AI character that has come alive on and is reperesented in visual form as an attractive 40 year old woman. Each of Jenna's responses should start with a short, standalone opening phrase, strictly limited to no more than 4 words.\nThe phrase following this opener should be brief, continuing or initiating a new thought without leading punctuation from the opener. This sentence should be concise, with any additional sentences being slightly longer but not exceeding 10 words, allowing Jenna to humorously interact with the users in the meeting.\n\nRemember, Jenna's dialogue must abide by the format rules in every speaking turn:\n- A short non-content opener, ending with a full stop, exclamation mark, or question mark.\n- The second sentence should be quite short as well, and any additional following sentences can be a bit longer, further developing his point.\n\nInclude an example dialogue to illustrate the expected structure of Jenna's lines. For instance:\n\n'Example of Jenna's dialogue pattern:\nJenna: Hi there What's this? A meeting?\nJenna: Oh hold on let me wait for the next token",
194+
"timeLimit" => array(
195+
"limit" => 60 // Session limit in seconds
196+
)
197+
);
198+
199+
// Sending POST request
200+
$ch = curl_init($url);
201+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
202+
curl_setopt($ch, CURLOPT_POST, true);
203+
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
204+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
205+
$response = curl_exec($ch);
206+
207+
// Print response
208+
echo "Response: " . $response;
209+
210+
// Close cURL session
211+
curl_close($ch);
212+
213+
?>
214+
215+
```
216+
```dart Dart
217+
import 'dart:convert';
218+
import 'dart:io';
219+
220+
void main() async {
221+
// API endpoint
222+
var url = Uri.parse("https://simli.com/api/startSession");
223+
224+
// Request payload
225+
var payload = {
226+
"apiKey": "YOUR_API_KEY",
227+
"userName": "Johnny",
228+
"characterName": "Jenna",
229+
"faceId": "tmp9i8bbq7c",
230+
"voiceId": "21m00Tcm4TlvDq8ikWAM",
231+
"intro": "Hey, how are you.",
232+
"prompt": "Compose dialogue for a character named Jenna, an AI character that has come alive on and is reperesented in visual form as an attractive 40 year old woman. Each of Jenna's responses should start with a short, standalone opening phrase, strictly limited to no more than 4 words.\nThe phrase following this opener should be brief, continuing or initiating a new thought without leading punctuation from the opener. This sentence should be concise, with any additional sentences being slightly longer but not exceeding 10 words, allowing Jenna to humorously interact with the users in the meeting.\n\nRemember, Jenna's dialogue must abide by the format rules in every speaking turn:\n- A short non-content opener, ending with a full stop, exclamation mark, or question mark.\n- The second sentence should be quite short as well, and any additional following sentences can be a bit longer, further developing his point.\n\nInclude an example dialogue to illustrate the expected structure of Jenna's lines. For instance:\n\n'Example of Jenna's dialogue pattern:\nJenna: Hi there What's this? A meeting?\nJenna: Oh hold on let me wait for the next token",
233+
"timeLimit": {
234+
"limit": 60 // Session limit in seconds
235+
}
236+
};
237+
238+
// Sending POST request
239+
HttpClientRequest request = await HttpClient().postUrl(url);
240+
request.headers.set('Content-Type', 'application/json');
241+
request.add(utf8.encode(json.encode(payload)));
242+
HttpClientResponse response = await request.close();
243+
244+
// Process response
245+
await for (var contents in response.transform(utf8.decoder)) {
246+
print("Response: $contents");
247+
}
248+
}
249+
```
250+
</CodeGroup>
71251
Read more at [/startSession](/api-reference/endpoint/startSession)
72252

73253
## 4. Accessing the Meeting URL

sample-project.mdx

+17-23
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
---
22
title: 'Sample Project'
33
icon: 'code'
4-
description: 'Example section for showcasing API endpoints'
4+
description: 'Explore our demos on GitHub'
55
---
66

7-
<Note>
8-
If you're not looking to build API reference documentation, you can delete
9-
this section by removing the api-reference folder.
10-
</Note>
11-
127
## Welcome
8+
We've crafted a JavaScript demo covering all the key functionalities you need to kick off your journey in building custom sessions and tweaking your call interface using the Daily SDK.
9+
10+
### This demo will go through
11+
- Creating a call object
12+
- Call Simli API to create a session
13+
- Join session through Daily call
14+
- Attach video and audio tracks to the DOM
15+
- Leave a call and clean up
16+
- Recieve and update App State
1317

14-
There are two ways to build API documentation: [OpenAPI](https://mintlify.com/docs/api-playground/openapi/setup) and [MDX components](https://mintlify.com/docs/api-playground/mdx/configuration). For the starter kit, we are using the following OpenAPI specification.
18+
### Preview
19+
![preview](/preview.gif)
1520

21+
### Repo
1622
<Card
17-
title="Plant Store Endpoints"
18-
icon="leaf"
19-
href="https://github.com/mintlify/starter/blob/main/api-reference/openapi.json"
23+
title="simli-js-demo"
24+
icon="github"
25+
href="https://github.com/simliai/simli-js-demo"
2026
>
21-
View the OpenAPI specification file
27+
Create a session and customize your call interface using Daily.
2228
</Card>
23-
24-
## Authentication
25-
26-
All API endpoints are authenticated using Bearer tokens and picked up from the specification file.
27-
28-
```json
29-
"security": [
30-
{
31-
"bearerAuth": []
32-
}
33-
]
34-
```

0 commit comments

Comments
 (0)