Create invitations
curl --request POST \
--url https://apix.us.amity.co/api/v1/invitations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "communityMemberInvite",
"targetType": "community",
"targetId": "68583742eae5300158b6d144",
"userIds": [
"B user",
"C user"
]
}
'import requests
url = "https://apix.us.amity.co/api/v1/invitations"
payload = {
"type": "communityMemberInvite",
"targetType": "community",
"targetId": "68583742eae5300158b6d144",
"userIds": ["B user", "C user"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'communityMemberInvite',
targetType: 'community',
targetId: '68583742eae5300158b6d144',
userIds: ['B user', 'C user']
})
};
fetch('https://apix.us.amity.co/api/v1/invitations', 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://apix.us.amity.co/api/v1/invitations",
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([
'type' => 'communityMemberInvite',
'targetType' => 'community',
'targetId' => '68583742eae5300158b6d144',
'userIds' => [
'B user',
'C user'
]
]),
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://apix.us.amity.co/api/v1/invitations"
payload := strings.NewReader("{\n \"type\": \"communityMemberInvite\",\n \"targetType\": \"community\",\n \"targetId\": \"68583742eae5300158b6d144\",\n \"userIds\": [\n \"B user\",\n \"C user\"\n ]\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://apix.us.amity.co/api/v1/invitations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"communityMemberInvite\",\n \"targetType\": \"community\",\n \"targetId\": \"68583742eae5300158b6d144\",\n \"userIds\": [\n \"B user\",\n \"C user\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v1/invitations")
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 \"type\": \"communityMemberInvite\",\n \"targetType\": \"community\",\n \"targetId\": \"68583742eae5300158b6d144\",\n \"userIds\": [\n \"B user\",\n \"C user\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"invitations": [
{
"_id": "<string>",
"networkId": "<string>",
"type": "communityMemberInvite",
"targetId": "<string>",
"targetType": "community",
"userId": "<string>",
"createdBy": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"invitationId": "<string>",
"invitedUserId": "<string>",
"invitedUserPublicId": "<string>",
"invitedUserInternalId": "<string>",
"inviterUserId": "<string>",
"inviterUserPublicId": "<string>",
"inviterUserInternalId": "<string>",
"respondedAt": "2023-11-07T05:31:56Z",
"communityId": "<string>"
}
],
"users": [
{
"userId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_id": "<string>",
"path": "<string>",
"userInternalId": "<string>",
"userPublicId": "<string>",
"roles": [
"<string>"
],
"permissions": [],
"displayName": "<string>",
"profileHandle": "<string>",
"description": "<string>",
"avatarFileId": "<string>",
"avatarCustomUrl": "<string>",
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"metadata": {},
"isGlobalBan": true,
"isBrand": true,
"isDeleted": true
}
]
}{
"status": "error",
"code": 400300,
"message": "Forbidden error."
}{
"status": "error",
"code": 400400,
"message": "Resource Not Found."
}{
"status": "error",
"code": 500000,
"message": "Parameters validation error!."
}{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}Invitation
Create invitations
Creates new invitations for the specified users to join a target entity (community, group, or event).
POST
/
api
/
v1
/
invitations
Create invitations
curl --request POST \
--url https://apix.us.amity.co/api/v1/invitations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "communityMemberInvite",
"targetType": "community",
"targetId": "68583742eae5300158b6d144",
"userIds": [
"B user",
"C user"
]
}
'import requests
url = "https://apix.us.amity.co/api/v1/invitations"
payload = {
"type": "communityMemberInvite",
"targetType": "community",
"targetId": "68583742eae5300158b6d144",
"userIds": ["B user", "C user"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'communityMemberInvite',
targetType: 'community',
targetId: '68583742eae5300158b6d144',
userIds: ['B user', 'C user']
})
};
fetch('https://apix.us.amity.co/api/v1/invitations', 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://apix.us.amity.co/api/v1/invitations",
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([
'type' => 'communityMemberInvite',
'targetType' => 'community',
'targetId' => '68583742eae5300158b6d144',
'userIds' => [
'B user',
'C user'
]
]),
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://apix.us.amity.co/api/v1/invitations"
payload := strings.NewReader("{\n \"type\": \"communityMemberInvite\",\n \"targetType\": \"community\",\n \"targetId\": \"68583742eae5300158b6d144\",\n \"userIds\": [\n \"B user\",\n \"C user\"\n ]\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://apix.us.amity.co/api/v1/invitations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"communityMemberInvite\",\n \"targetType\": \"community\",\n \"targetId\": \"68583742eae5300158b6d144\",\n \"userIds\": [\n \"B user\",\n \"C user\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v1/invitations")
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 \"type\": \"communityMemberInvite\",\n \"targetType\": \"community\",\n \"targetId\": \"68583742eae5300158b6d144\",\n \"userIds\": [\n \"B user\",\n \"C user\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"invitations": [
{
"_id": "<string>",
"networkId": "<string>",
"type": "communityMemberInvite",
"targetId": "<string>",
"targetType": "community",
"userId": "<string>",
"createdBy": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"invitationId": "<string>",
"invitedUserId": "<string>",
"invitedUserPublicId": "<string>",
"invitedUserInternalId": "<string>",
"inviterUserId": "<string>",
"inviterUserPublicId": "<string>",
"inviterUserInternalId": "<string>",
"respondedAt": "2023-11-07T05:31:56Z",
"communityId": "<string>"
}
],
"users": [
{
"userId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"_id": "<string>",
"path": "<string>",
"userInternalId": "<string>",
"userPublicId": "<string>",
"roles": [
"<string>"
],
"permissions": [],
"displayName": "<string>",
"profileHandle": "<string>",
"description": "<string>",
"avatarFileId": "<string>",
"avatarCustomUrl": "<string>",
"flagCount": 123,
"hashFlag": {
"bits": 123,
"hashes": 123,
"hash": [
"<string>"
]
},
"metadata": {},
"isGlobalBan": true,
"isBrand": true,
"isDeleted": true
}
]
}{
"status": "error",
"code": 400300,
"message": "Forbidden error."
}{
"status": "error",
"code": 400400,
"message": "Resource Not Found."
}{
"status": "error",
"code": 500000,
"message": "Parameters validation error!."
}{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Create invitation request payload
Type of invitation to create
Available options:
communityMemberInvite, livestreamCohostInvite Example:
"communityMemberInvite"
Type of target entity
Available options:
community, room Example:
"community"
ID of the target entity (community, group, etc.)
Required string length:
1 - 900Example:
"68583742eae5300158b6d144"
Array of user IDs to invite
Required array length:
1 - 1000 elementsUser ID to invite
Required string length:
1 - 50Example:
["user123", "user456", "user789"]
⌘I