JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
const response = await client.assistant.conversations.send({
message: 'x',
sessionId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
});
console.log(response.assistantText);import os
from mobilerun_sdk import Mobilerun
client = Mobilerun(
api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"), # This is the default and can be omitted
)
response = client.assistant.conversations.send(
message="x",
session_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.assistant_text)curl --request POST \
--url https://api.mobilerun.ai/v1/assistant/chat/message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/v1/assistant/chat/message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>',
'sessionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'agent' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mobilerun.ai/v1/assistant/chat/message"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"sessionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mobilerun.ai/v1/assistant/chat/message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"sessionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/v1/assistant/chat/message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"sessionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"assistantText": "<string>",
"chatSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errorText": "<string>"
}{
"code": "insufficient_credits",
"errorText": "<string>",
"remaining": 123
}{
"message": "<string>"
}{
"message": "<string>"
}{
"code": "session_machine_replaced",
"message": "<string>",
"recovery": "handoff"
}{
"message": "<string>"
}{
"code": "billing_unavailable",
"errorText": "<string>"
}{
"assistantText": "<string>",
"chatSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errorText": "<string>"
}Chat
Send a single user message
Send a single user message. The response format follows the Accept header: text/event-stream for SSE, application/json for a buffered assistant reply. sessionId targets a concrete active chat. The resolved chat session ID is returned as chatSessionId in the JSON body and as the X-Chat-Session-Id response header on the SSE response.
POST
/
assistant
/
chat
/
message
JavaScript
import Mobilerun from '@mobilerun/sdk';
const client = new Mobilerun({
apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
});
const response = await client.assistant.conversations.send({
message: 'x',
sessionId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
});
console.log(response.assistantText);import os
from mobilerun_sdk import Mobilerun
client = Mobilerun(
api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"), # This is the default and can be omitted
)
response = client.assistant.conversations.send(
message="x",
session_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(response.assistant_text)curl --request POST \
--url https://api.mobilerun.ai/v1/assistant/chat/message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mobilerun.ai/v1/assistant/chat/message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>',
'sessionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'agent' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mobilerun.ai/v1/assistant/chat/message"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"sessionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mobilerun.ai/v1/assistant/chat/message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"sessionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mobilerun.ai/v1/assistant/chat/message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"sessionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"assistantText": "<string>",
"chatSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errorText": "<string>"
}{
"code": "insufficient_credits",
"errorText": "<string>",
"remaining": 123
}{
"message": "<string>"
}{
"message": "<string>"
}{
"code": "session_machine_replaced",
"message": "<string>",
"recovery": "handoff"
}{
"message": "<string>"
}{
"code": "billing_unavailable",
"errorText": "<string>"
}{
"assistantText": "<string>",
"chatSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errorText": "<string>"
}Authorizations
Bearer token via Authorization header
Body
application/json
Was this page helpful?
⌘I