Send message to an agent from your own platform
curl --request POST \
--url 'https://api.vida.dev/api/v2/agent/receiveMessage?token=' \
--header 'Content-Type: application/json' \
--data '
{
"targetAgent": "agent123",
"sourceAddress": "+15551231234",
"message": "Hello there",
"attachments": [
{
"type": "image",
"url": "https://example.com/image.png"
}
],
"context": {
"threadId": "abc123"
},
"metadata": {
"key": "value"
},
"outboundMessageWebhookUrl": "https://example.com/hook"
}
'import requests
url = "https://api.vida.dev/api/v2/agent/receiveMessage?token="
payload = {
"targetAgent": "agent123",
"sourceAddress": "+15551231234",
"message": "Hello there",
"attachments": [
{
"type": "image",
"url": "https://example.com/image.png"
}
],
"context": { "threadId": "abc123" },
"metadata": { "key": "value" },
"outboundMessageWebhookUrl": "https://example.com/hook"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
targetAgent: 'agent123',
sourceAddress: '+15551231234',
message: 'Hello there',
attachments: [{type: 'image', url: 'https://example.com/image.png'}],
context: {threadId: 'abc123'},
metadata: {key: 'value'},
outboundMessageWebhookUrl: 'https://example.com/hook'
})
};
fetch('https://api.vida.dev/api/v2/agent/receiveMessage?token=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vida.dev/api/v2/agent/receiveMessage?token=",
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([
'targetAgent' => 'agent123',
'sourceAddress' => '+15551231234',
'message' => 'Hello there',
'attachments' => [
[
'type' => 'image',
'url' => 'https://example.com/image.png'
]
],
'context' => [
'threadId' => 'abc123'
],
'metadata' => [
'key' => 'value'
],
'outboundMessageWebhookUrl' => 'https://example.com/hook'
]),
CURLOPT_HTTPHEADER => [
"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.vida.dev/api/v2/agent/receiveMessage?token="
payload := strings.NewReader("{\n \"targetAgent\": \"agent123\",\n \"sourceAddress\": \"+15551231234\",\n \"message\": \"Hello there\",\n \"attachments\": [\n {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.png\"\n }\n ],\n \"context\": {\n \"threadId\": \"abc123\"\n },\n \"metadata\": {\n \"key\": \"value\"\n },\n \"outboundMessageWebhookUrl\": \"https://example.com/hook\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.vida.dev/api/v2/agent/receiveMessage?token=")
.header("Content-Type", "application/json")
.body("{\n \"targetAgent\": \"agent123\",\n \"sourceAddress\": \"+15551231234\",\n \"message\": \"Hello there\",\n \"attachments\": [\n {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.png\"\n }\n ],\n \"context\": {\n \"threadId\": \"abc123\"\n },\n \"metadata\": {\n \"key\": \"value\"\n },\n \"outboundMessageWebhookUrl\": \"https://example.com/hook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vida.dev/api/v2/agent/receiveMessage?token=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"targetAgent\": \"agent123\",\n \"sourceAddress\": \"+15551231234\",\n \"message\": \"Hello there\",\n \"attachments\": [\n {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.png\"\n }\n ],\n \"context\": {\n \"threadId\": \"abc123\"\n },\n \"metadata\": {\n \"key\": \"value\"\n },\n \"outboundMessageWebhookUrl\": \"https://example.com/hook\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"messageUuid": "uuid"
}{
"success": false,
"message": "Invalid Vida user"
}Messaging
Send message to an agent from your own platform
Send a message from your platform to an agent. Must pass outboundMessageWebhookUrl or configure on the organization to receive agent responses. Reseller or partners only.
POST
/
api
/
v2
/
agent
/
receiveMessage
Send message to an agent from your own platform
curl --request POST \
--url 'https://api.vida.dev/api/v2/agent/receiveMessage?token=' \
--header 'Content-Type: application/json' \
--data '
{
"targetAgent": "agent123",
"sourceAddress": "+15551231234",
"message": "Hello there",
"attachments": [
{
"type": "image",
"url": "https://example.com/image.png"
}
],
"context": {
"threadId": "abc123"
},
"metadata": {
"key": "value"
},
"outboundMessageWebhookUrl": "https://example.com/hook"
}
'import requests
url = "https://api.vida.dev/api/v2/agent/receiveMessage?token="
payload = {
"targetAgent": "agent123",
"sourceAddress": "+15551231234",
"message": "Hello there",
"attachments": [
{
"type": "image",
"url": "https://example.com/image.png"
}
],
"context": { "threadId": "abc123" },
"metadata": { "key": "value" },
"outboundMessageWebhookUrl": "https://example.com/hook"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
targetAgent: 'agent123',
sourceAddress: '+15551231234',
message: 'Hello there',
attachments: [{type: 'image', url: 'https://example.com/image.png'}],
context: {threadId: 'abc123'},
metadata: {key: 'value'},
outboundMessageWebhookUrl: 'https://example.com/hook'
})
};
fetch('https://api.vida.dev/api/v2/agent/receiveMessage?token=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vida.dev/api/v2/agent/receiveMessage?token=",
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([
'targetAgent' => 'agent123',
'sourceAddress' => '+15551231234',
'message' => 'Hello there',
'attachments' => [
[
'type' => 'image',
'url' => 'https://example.com/image.png'
]
],
'context' => [
'threadId' => 'abc123'
],
'metadata' => [
'key' => 'value'
],
'outboundMessageWebhookUrl' => 'https://example.com/hook'
]),
CURLOPT_HTTPHEADER => [
"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.vida.dev/api/v2/agent/receiveMessage?token="
payload := strings.NewReader("{\n \"targetAgent\": \"agent123\",\n \"sourceAddress\": \"+15551231234\",\n \"message\": \"Hello there\",\n \"attachments\": [\n {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.png\"\n }\n ],\n \"context\": {\n \"threadId\": \"abc123\"\n },\n \"metadata\": {\n \"key\": \"value\"\n },\n \"outboundMessageWebhookUrl\": \"https://example.com/hook\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.vida.dev/api/v2/agent/receiveMessage?token=")
.header("Content-Type", "application/json")
.body("{\n \"targetAgent\": \"agent123\",\n \"sourceAddress\": \"+15551231234\",\n \"message\": \"Hello there\",\n \"attachments\": [\n {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.png\"\n }\n ],\n \"context\": {\n \"threadId\": \"abc123\"\n },\n \"metadata\": {\n \"key\": \"value\"\n },\n \"outboundMessageWebhookUrl\": \"https://example.com/hook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vida.dev/api/v2/agent/receiveMessage?token=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"targetAgent\": \"agent123\",\n \"sourceAddress\": \"+15551231234\",\n \"message\": \"Hello there\",\n \"attachments\": [\n {\n \"type\": \"image\",\n \"url\": \"https://example.com/image.png\"\n }\n ],\n \"context\": {\n \"threadId\": \"abc123\"\n },\n \"metadata\": {\n \"key\": \"value\"\n },\n \"outboundMessageWebhookUrl\": \"https://example.com/hook\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"messageUuid": "uuid"
}{
"success": false,
"message": "Invalid Vida user"
}Authorizations
Vida API Token
Body
application/json
Agent account ID, phone number, or username
Example:
"agent123"
Sender phone number or address
Example:
"+15551231234"
Message text
Example:
"Hello there"
Show child attributes
Show child attributes
Example:
[
{
"type": "image",
"url": "https://example.com/image.png"
}
]
Example:
{ "threadId": "abc123" }
Example:
{ "key": "value" }
Webhook URL (POST) to deliver agent responses to. If not specified will look for default outboundMessageWebhookUrl webhook settings.
Example:
"https://example.com/hook"
⌘I