Bad Request on HTTP.Post with Discord Bot - api

Greetings and thank you for tending to this question!
I am trying to have my Discord bot create a Scheduled Guild Event.
A Calendar event for players and attendees to join a voice channel.
I am trying to achieve that by doing a POST call to Discord's API, and I am failing with the following error.
The following message was produced from a Postman test.
{
"code": 50109,
"message": "The request body contains invalid JSON."
}
As the message implies something is off with my JSON body.
Below follows a version of the JSON body I am trying to send!
{
"name": "The Bot created this!!!",
"privacy_level": 2,
"scheduled_start_time": "2022-06-15T15:00:00+00:00",
"description": "The Bot also described this!!",
"channel_id": 980830611458426901,
"entity_type": 2
}
I tried to follow the API's documentation as perfect as I could with no positive results!!
If you wish to follow the documentation yourselves here's the link:
Create Guild Scheduled Event
I am definitely missing something or adding something that should be added to the JSON body
of a different type!!! Any insights welcome!
What I know and tried
My authentication is solid because I am able to GET all events present.
Many variations of single quotes '' and type declarations for the data in the JSON body.
Regardless of insights, Thank you for your time!!

Related

How do I redeem a domain with GoDaddy's API?

I have a subaccount that has a domain in the "redemption" state after it expired, and I would like to "redeem" it so I can renew it. From looking in the API docs, it is only available in the v2 API, and I was able to get started in the v2 API with some help. However, even with the correct UUIDv4 customer ID for the domain, I get the error: { "code": "ERROR_INTERNAL", "message": "Internal Server Error"}
The POST body is not labelled as required in the docs, but it is required. To get details on each of the fields, you need to click on the button (which is easy to miss) that switches between "Example Value" and "Model" (screenshot)

Create stickerpack using only Telegram Bot Api (or telegram api)

The documentation describes methods for creating packs through api, but using them I constantly encounter various kinds of errors, mainly when sending images in a request. In general, maybe someone had experience in creating sticker packs through api, and maybe someone would like to share it)))
Update
Forgot to say that I use postman to learn api. Below is an example of a sticker file upload request:
request body
Headers
Request URI
https://api.telegram.org/botBOT_TOKEN/uploadStickerFile
And response that i get:
{
"ok": false,
"error_code": 413,
"description": "Request Entity Too Large"
}

Slack workspace bot to bot communication

i am trying to send messages through Amazon alexa via a bot-user to an already created chat bot that is within the workspace already.
after using webhooks i realised the chatbot does not recognize the messages i am posting through my bot-user.
my problem solving attempts included:
using the "as_user" method set as true. so messages are sent by the user but it seems to only visually change the name of the bot-user and my chat bot still does not respond to my messages.
is it even possible for a bot-user using slack web API to communicate to an App-bot that is within a channel on a workspace? I am using Postman to test. i suspect it has something to do with he scopes of the bot-user and the chatbot within the workspace just not being able to see the bot-user scope. This is all within the slack web api and this is how i am communicating with the workspace through the bot user.
see images to illustrate.
thanks alot hope you can help! :)
First image of postman:
second image of slack intentions:
Messages from real users look slightly different then message from bots / apps.
Apparently your chatbot is ignoring messages that are not coming form a real user. So the only way to "fix" that would be to modify the chatbot logic.
Example for message from real user:
{
"type": "message",
"user": "U12345467",
"text": "Good read for some of guys",
"ts": "1531745292.000021"
}
Example for a bot message:
{
"text": "Hey guys",
"bot_id": "B12345678",
"type": "message",
"subtype": "bot_message",
"ts": "1531700187.000049"
}

Google consumer surveys - retrieve results via API

I am trying to retrieve the results of a completed Google survey. Using this url/resource per the google docs: I get the same error when attempting through the Google playground.
Get: https://www.googleapis.com/consumersurveys/v2/surveys/{my surveyurlID}/results.
I get the following error:
"domain": "global",
"reason": "INVALID_VALUE",
"message": "Invalid Value supplied to API:
Authentication token is same as used to get the survey meta data ( which works).
Not sure what value is invalid. Any help appreciated.
Unfortunately, the "try it now" widget doesn't support media downloads and we currently only provide the results as an excel file.
In order to get the results you'll need to specify a media type in your request. You can do so with the following endpoint:
GET https://www.googleapis.com/consumersurveys/v2/surveys/survey_id/results?alt=media
I would recommend using an OAuth 2 library to authenticate and then accessing the above endpoint.
We'll work on improving the documentation and clarifying this.
Thanks for bringing this to our attention.

Telegram Bot API errors codes (integrating Groups and Channels)

I'm working on my open-source project BOTServer a http://telegram.org Bot Platform Webhooks Server, for Rubyists.
I experienced strange error when sending messages (sendMessage API endpoint) on a Telegram Bot I created. when sending messages to a specific Bot I created, I got these errors:
Error code 400 -> Bad Request: group is deactivated
Telegram::Bot::Exceptions::ResponseError - Telegram API has returned the error. (ok: "false", error_code: "400", description: "[Error]: Bad Request: group is deactivated")
and/or
Error code 403 -> Bot was kicked from a chat
Telegram::Bot::Exceptions::ResponseError - Telegram API has returned the error. (ok: "false", error_code: "403", description: "[Error]: Bot was kicked from a chat")
That's really strange.
It seems that the problem is related to the "story" of a specific Bot (errors are not systematic and I do not have issues with another bot). In facts I done these steps:
I create the bot (lets cal it: MYbot)
I ADDED the bot to a Telegram Group (e.g. MYGroup)
I REMOVED the bot from the Group
I send messages from the bot in reply to a user (then I got errors)
Question 1
Ok I'm pretty sure something wrong happened Telegram Serve side and I could delete and rebuild the bot... Any better idea about a solution ?
Question 2
There is a published list of Telegram Bot errors ? I didn't find in Telegram Bot documentation/tutorials.
I love Telegram architecture! But I feel there are some issue/bugs with Bots APIs especially in recent possibilities to insert Bots in Groups and Cahnnel. Any similar experience ?
I answer myself having found a possible reason of the problem. The problem arise just with a single specific Bot I created in past (and I removed from a group). As specificed in question:
Step by step story
step 1:
After creation I added that bot on a group with 2 users: (myself and a second person).
step 2:
Afterward I removed that bot from the group.
step 3:
I used that bot to test my BOTserver
sending SendMessage od reply to webhook update.
Now i experienced the mentioned 400/403 errors.
step 4:
I DELETED that Bot, chatting with BotFather.
step 5:
I created again the same Bot with the **SAME identichal name*
Step 6:
I tested again, an I rised the usual issue:
Telegram API has returned the error. (ok: "false", error_code: "401", description: "[Error]: Unauthorized"):
Step 7:
I created new bot(s) with different name(s)
Finally, no more errors!
Conclusion:
I fair the original Bot name remained in a "wrong" Telegram server internal status. My hypotesis is that adding/removing Bots from Groups have some problem/bug.
My Solution:
delete the bot name created problems, no more using that "name" :(
recreate a bot with different name.
Any similar experience ?
I,m getting this error through WebHook requests.
This issue occurs after adding bot to a group and disable bot Add to group feature via BotFather.
This issue exists until i fetch updates manually by /getUpdates method and make them passed for Telegram server and after that WebHook works fine.
Hope this works for you too.
return ok if bot API return respond error, like this example
try {
return Telegram::sendMessage($message);
} catch (TelegramResponseException $exception) {
Log::info($exception->getMessage());
return ['ok' => 'true'];
}