Create a message
Send a message within an existing conversation. The message is delivered to all participants in the conversation.
curl --request POST \
--url https://api-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-api-secret: <x-api-secret>' \
--data '
{
"body": "<string>"
}
'import requests
url = "https://api-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages"
payload = { "body": "<string>" }
headers = {
"x-api-key": "<x-api-key>",
"x-api-secret": "<x-api-secret>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-api-secret': '<x-api-secret>',
'Content-Type': 'application/json'
},
body: JSON.stringify({body: JSON.stringify('<string>')})
};
fetch('https://api-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages', 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-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages",
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([
'body' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-api-secret: <x-api-secret>"
],
]);
$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-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages"
payload := strings.NewReader("{\n \"body\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-api-secret", "<x-api-secret>")
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-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages")
.header("x-api-key", "<x-api-key>")
.header("x-api-secret", "<x-api-secret>")
.header("Content-Type", "application/json")
.body("{\n \"body\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-api-secret"] = '<x-api-secret>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"body\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"createdAt": "<string>",
"uid": "<string>",
"body": "<string>",
"conversation": {
"createdAt": "<string>",
"uid": "<string>",
"name": "<string>",
"deleted": true,
"locked": true,
"read": true,
"participants": [
{
"uid": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"read": true,
"deleted": true,
"foreignId": "<string>"
}
],
"updatedAt": "<string>",
"metadata": {
"projectId": "<string>",
"surveyResponseId": "<string>",
"externalResearcherId": "<string>",
"externalTeamId": "<string>",
"externalCompanyId": "<string>"
}
},
"sender": {
"uid": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"foreignId": "<string>"
},
"updatedAt": "<string>"
}Path Parameters
Body
Body of message.
Response
Unique identifier of message.
Body of message.
Conversation message belongs to.
Hide child attributes
Hide child attributes
Unique identifier of conversation.
Name of conversation.
If conversation is marked as deleted.
If conversation is locked.
All participants of conversation including the researcher. The researcher will be the API owner/admin account for the api team.
Hide child attributes
Hide child attributes
Unique identifier for messaging user.
First name of user.
Last name initial of user.
Whether the participant has read the conversation.
Whether the participant has muted the conversation.
UserId of messaging user.
Metadata of conversation.
Hide child attributes
Hide child attributes
ProjectId of the project the coversation belongs to.
ScreenerResponseId for the project, if exists.
ExternalResearcherId for the project, if exists.
ExternalTeamId for the project, if exists.
ExternalCompanyId for the project, if exists.
Sender of message.
Either a participant or the api team owner/admin.
To find the external researcher, use conversation.metadata.externalResearcherId.
Was this page helpful?
curl --request POST \
--url https://api-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-api-secret: <x-api-secret>' \
--data '
{
"body": "<string>"
}
'import requests
url = "https://api-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages"
payload = { "body": "<string>" }
headers = {
"x-api-key": "<x-api-key>",
"x-api-secret": "<x-api-secret>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-api-secret': '<x-api-secret>',
'Content-Type': 'application/json'
},
body: JSON.stringify({body: JSON.stringify('<string>')})
};
fetch('https://api-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages', 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-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages",
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([
'body' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-api-secret: <x-api-secret>"
],
]);
$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-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages"
payload := strings.NewReader("{\n \"body\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-api-secret", "<x-api-secret>")
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-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages")
.header("x-api-key", "<x-api-key>")
.header("x-api-secret", "<x-api-secret>")
.header("Content-Type", "application/json")
.body("{\n \"body\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-staging.respondent.io/v1/messaging/conversations/{conversationUid}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-api-secret"] = '<x-api-secret>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"body\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"createdAt": "<string>",
"uid": "<string>",
"body": "<string>",
"conversation": {
"createdAt": "<string>",
"uid": "<string>",
"name": "<string>",
"deleted": true,
"locked": true,
"read": true,
"participants": [
{
"uid": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"read": true,
"deleted": true,
"foreignId": "<string>"
}
],
"updatedAt": "<string>",
"metadata": {
"projectId": "<string>",
"surveyResponseId": "<string>",
"externalResearcherId": "<string>",
"externalTeamId": "<string>",
"externalCompanyId": "<string>"
}
},
"sender": {
"uid": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"foreignId": "<string>"
},
"updatedAt": "<string>"
}