API - Virtual Message

I get the error {"code":"invalid_type","expected":"object","received":"undefined","path":["channel"],"message":"Required"}, {"code":"invalid_type","expected":"object","received":"undefined","path":["member"],"message":"Required"}, {"code":"invalid_type","expected":"object","received":"undefined","path":["guild"],"message":"Required"}, {"code":"unrecognized_keys","keys":["body"],"path":[],"message":"Unrecognized key(s) in object: 'body'"} when trying to use the endpoint
https://api.kiaibot.com/v1/guild/{guildID}/virtual_message
https://api.kiaibot.com/v1/guild/{guildID}/virtual_message
any reason why?
Solution:
That would probably be part of it yes. You need to use a KIAI api token as authorization
Jump to solution
20 Replies
Jamie
JamieOP7mo ago
My body is
{
"channel": {
"id": "1180619534504304790",
"parentId": "1101574719246979203",
"message": "Your message here"
},
"member": {
"id": "859925195598331935",
"roles": [
{
"id": "1209602524357730405"
}
]
},
"guild": {
"id": "1101574716180930562"
}
}
{
"channel": {
"id": "1180619534504304790",
"parentId": "1101574719246979203",
"message": "Your message here"
},
"member": {
"id": "859925195598331935",
"roles": [
{
"id": "1209602524357730405"
}
]
},
"guild": {
"id": "1101574716180930562"
}
}
net-tech-
net-tech-7mo ago
Hi, message under channel is something you do not need to provide https://api.kiaibot.com/docs/static/index.html#/v1%2F/post_v1_guild__guildId__virtual_message It seems like it's because of that but let me double-check
Jamie
JamieOP7mo ago
so remove the channel object?
net-tech-
net-tech-7mo ago
No, try removing message under the channel object
Jamie
JamieOP7mo ago
1 second. still get the same error.
net-tech-
net-tech-7mo ago
The exact same?
Jamie
JamieOP7mo ago
yep.
net-tech-
net-tech-7mo ago
Can I get back to you a bit later in the day about this? I need to finish something IRL
Jamie
JamieOP7mo ago
Yeah sure.
net-tech-
net-tech-7mo ago
Thanks
Jamie
JamieOP7mo ago
here is the error, but in a more readable state.
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"channel"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"member"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"guild"
],
"message": "Required"
},
{
"code": "unrecognized_keys",
"keys": [
"body"
],
"path": [],
"message": "Unrecognized key(s) in object: 'body'"
}
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"channel"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"member"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "object",
"received": "undefined",
"path": [
"guild"
],
"message": "Required"
},
{
"code": "unrecognized_keys",
"keys": [
"body"
],
"path": [],
"message": "Unrecognized key(s) in object: 'body'"
}
net-tech-
net-tech-7mo ago
It's saying that channel, member, and guild are missing which judging from https://discord.com/channels/744282929684938844/1242393263365820507/1242393839298285639 should not be true. However, with the exact same POST request as yours (excluding of course changing the guild id and removing the message from channel, I get success
POST /v1/guild/1041045270659604701/virtual_message HTTP/1.1
Host: api.kiaibot.com
Accept: */*
Authorization: <redact>
Content-Type: application/json
User-Agent: insomnia/9.2.0
Content-Length: 323

{
"channel": {
"id": "1180619534504304790",
"parentId": "1101574719246979203"
},
"member": {
"id": "461862173044375572",
"roles": [
{
"id": "1209602524357730405"
}
]
},
"guild": {
"id": "1041045270659604701"
}
}
POST /v1/guild/1041045270659604701/virtual_message HTTP/1.1
Host: api.kiaibot.com
Accept: */*
Authorization: <redact>
Content-Type: application/json
User-Agent: insomnia/9.2.0
Content-Length: 323

{
"channel": {
"id": "1180619534504304790",
"parentId": "1101574719246979203"
},
"member": {
"id": "461862173044375572",
"roles": [
{
"id": "1209602524357730405"
}
]
},
"guild": {
"id": "1041045270659604701"
}
}
HTTP/1.1 200 OK
Date: Tue, 21 May 2024 09:08:04 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 21
Connection: keep-alive
access-control-allow-origin: *
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
x-ratelimit-reset: 1716282529754
x-ratelimit-reset-after: 46
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=JfVG8yTAnPbuLCWAhOYJeN2NXAKd%2FJzICHNJ6RTaZzP0P9%2FcnFbGUIak183UmB2CISjm3NcN6jxZO%2FIpq9HoKZV414LP9IM0CWlXr%2Bx2Ev9jwK5G91Juk7xtrOqXDFTiEKk%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 88736b736cf4b363-PRG
alt-svc: h3=":443"; ma=86400

{
"message": "Success"
}
HTTP/1.1 200 OK
Date: Tue, 21 May 2024 09:08:04 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 21
Connection: keep-alive
access-control-allow-origin: *
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
x-ratelimit-reset: 1716282529754
x-ratelimit-reset-after: 46
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=JfVG8yTAnPbuLCWAhOYJeN2NXAKd%2FJzICHNJ6RTaZzP0P9%2FcnFbGUIak183UmB2CISjm3NcN6jxZO%2FIpq9HoKZV414LP9IM0CWlXr%2Bx2Ev9jwK5G91Juk7xtrOqXDFTiEKk%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 88736b736cf4b363-PRG
alt-svc: h3=":443"; ma=86400

{
"message": "Success"
}
Jamie
JamieOP7mo ago
Right. Let me try again with your format.. I still get a 400: Bad request Same error message. I wonder is it because I'm using a Discord Bot Token as my authorization, and not a Kiai token? If so I would like to request one: - Bot ID: 937703207042449438 - Application Name: Xmas Lume
Solution
net-tech-
net-tech-7mo ago
That would probably be part of it yes. You need to use a KIAI api token as authorization
Jamie
JamieOP7mo ago
mmm.
net-tech-
net-tech-7mo ago
Do you already have one or do you need one made
Jamie
JamieOP7mo ago
Need one made please.
net-tech-
net-tech-7mo ago
@Shadow need a api app made for @Jamie
Shadow
Shadow7mo ago
Done! Should be DMed to you
Jamie
JamieOP7mo ago
Received, thank you.
Want results from more Discord servers?
Add your server