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

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"
}

Related

Bad Request on HTTP.Post with Discord Bot

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!!

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"
}

Instagram API - Getting invalid media id with video shortcode

I'm using the /media/shortcode/shortcode endpoint of instagram to get information about a certain media with a shortcode.
https://www.instagram.com/developer/endpoints/media/#get_media_by_shortcode
The problem is when I pass a photo's shortcode to the endpoint everything works fine and I get the result I'm expecting from Instagram, however, when I pass a video's shortcode to that endpoint, the api returns the following:
{
"meta": {
"code": 400,
"error_type": "APINotFoundError",
"error_message": "invalid media id"
}
}
Which does not make a lot of sense to me since the given endpoint should work just fine with videos.
I was running into this issue too---the Instagram documentation is not super clear, but this is because of the limitations of Sandbox mode.
To help you develop and test your app, the users and media available in Sandbox mode are real Instagram data (i.e. what is normally visible in the Instagram app), but with the following conditions:
Apps in sandbox are restricted to 10 users
Data is restricted to the 10 users and the 20 most recent media from each of those users
Reduced API rate limits
From https://www.instagram.com/developer/sandbox/.
TLDR you'll need to get your app approved to have your other API calls work.
The best and the easiest way to get the media info, either being photo or video is by calling this url (GET method) Insta Fetch Media URL
Sample code written in Python.
import requests, json
def get_media_id(image_url):
url = "https://api.instagram.com/oembed/"
querystring = {"callback": "", "url": image_url}
headers = {
'cache-control': "no-cache"
}
response = requests.request("GET", url, headers=headers, params=querystring)
return json.loads(response.text)

Instagram API for ADS posts not working

I get instagram post details (likes, comments) by using the media endpoint:
$data1 = file_get_contents("https://api.instagram.com/v1/media/$media_id/likes?access_token=$access_token");
This works for normal posts from my feed, but when I input the $media_id for an instagram post that is an AD I always get invalid media id
{
"meta": {
"error_type": "APINotFoundError",
"code": 400,
"error_message": "invalid media id"
}
}
Are ads treated as different types of posts or the API is unable to retrieve any details from them?
Yes, the ads are treated like a different type of post and can only be managed or fully read by means of the Facebook APIs. Try the Graph API, the Marketing API or the Business Manager API, that's where I got the most useful tips and results.
(sorry, dont have enough rep to post more than two links. But don't worry, you'll find it on google in a heartbeat)
Instagram ADS API has been integrated into Facebook Marketing API.
All the details are here: https://developers.facebook.com/docs/marketing-api/guides/instagramads/ads_management/v2.6
There is a workaround to get some details on an AD. If you query the oembed endpoint, like this: https://api.instagram.com/oembed/?url=https://www.instagram.com/p/BAZV-jVlFGp/ you get some data.
I wasn't able to get any comments though.

Paypal REST API - getting 404 when trying to get webhook event with its HATEOS self url

I experimenting with Paypal REST API and I was stunned into a problem with webhooks.
I trying use the following tactic to verify event data - ensure that HATEOAS link with rel == "self" like https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-6L177801XL962315K-5B870910V53268712 is present, and ensure that this link starts with expected API endpoint (set in web.config) and reloads event data with it, and use it as trusted event data.
But this tactic fails, it results to 404 instead of getting webhook data.
Who else used Paypal REST API webhooks? How you are verify that the event come from trusted event source?
Update
Was able to get more details on messages received. Response body:
Data [{\r\n \"name\": \"INVALID_RESOURCE_ID\",\r\n \"details\": [],\r\n \"message\": \"Resource id is invalid\"\r\n}]
Headers as JSON object: [{\r\n \"PROXY_SERVER_INFO\": [\r\n \"host=slcsbplatformapiserv3002.slc.paypal.com;threadId=370534\"\r\n ],\r\n \"Paypal-Debug-Id\": [\r\n \"e33a2f285d46f\"\r\n ],\r\n \"SERVER_INFO\": [\r\n \"webhooksplatformserv:ppaas_1_2.v1.notifications.webhooks-events.id.GET&CalThreadId=184&TopLevelTxnStartTime=14b4099eb05&Host=slcsbwebhooksplatformserv3002.slc.paypal.com&pid=29135\"\r\n ],\r\n \"Date\": [\r\n \"Sat, 31 Jan 2015 15:26:44 GMT\"\r\n ],\r\n \"Server\": [\r\n \"Apache-Coyote/1.1\"\r\n ]\r\n}]
The hateoas link should return the same payload as the original webhook event. So there seems to be some issue there.
However, if your intention is to validate if the event came from PayPal then the correct way is to validate the signature included in the webhooks header. This link has more details around the security aspects in webhooks.
https://developer.paypal.com/webapps/developer/docs/integration/direct/rest-webhooks-overview/#event-security