Error when uploading a video using instagram graph API - api

I want to upload a video using the instagram graph api however the API asks for an url (and not a local path) for the video parameter. The video I want to upload is on my desktop (local) so I don't know how I can convert it so it works.
When I put a local path instead of the url I get the following message:
`
{
"error": {
"message": "The video file you selected is in a format that we don't support.",
"type": "OAuthException",
"code": 352,
"error_subcode": 2207026,
"is_transient": false,
"error_user_title": "Unsupported format",
"error_user_msg": "The video format is not supported. Please check the specs for the supported streams format",
"fbtrace_id": "AA3qcWZCmMsp0OfEE_m1cLJ"
}
}
`

Related

How to send image to Telegram Bot?

Trying to send image (or any type of file) to telegram bot.
It possible to take blob, convert it to Base64 and POST it?
I've tried to test it via SOAPUI but:
https://api.telegram.org/botXXX/sendDocument
{
"chat_id":XXX,
"document":"R0lGODlhKAAoAMIAAAAAAL6+vgCYAOfn5wAA/wAAAAAAAAAAACH5BAEAAAEALAAAAAAoACgAAAPYGLrc/jDKSau9OOvNu19AKIafIxJoioplqL4vyQEwIdw1AWw0fAu52w5D+xlxNeOw0rMdjb6fztJ0PpEp6FJSDQKjqS2kNxigygQ0Do1Om6fc89tNX5vbdPhYnmKb7Xl5Yg00eHSGfipogwyFb3eQh5GPZowgkpiJmgMClgqOmZOibp1xbmWop6h+q5ylEWStkJSzq0ITsX1pWTd3fa6elzkqR1HBwsNWWFnHIMtRUi+vTNFJzysZANe8Nc0PXdLdHQDgOeQt5ObnJY3k7uvs8fLz9PX29/EJADs="
}
In that case response:
{
"ok": false,
"error_code": 400,
"description": "Bad Request: wrong remote file identifier specified: Wrong character in the string"
}
You just had to send request with form-data)

Tring to fetch a ISOM video stream via API on postman and getting below mentioned error, can anyone suggest what this could be?

{
"statusCode": "ServiceError",
"statusString": "Invalid URI: Invalid port specified.",
"id": null,
"extension":
{
"streamURL": "",
"name": "isomStreamResponseStatus"
}
}
Video feed is working fine on web browser getting 200 ok status.

How to use Google Drive URL for Facebook Graph API

I try using Facebook Graph API with the upload photo feature.
I'm hosting the photo from Google Drive and the URL has the format: https://drive.google.com/uc?id=IMAGE_ID
But I received the error after I make the first request:
{
"error": {
"message": "Missing or invalid image file",
"type": "OAuthException",
"code": 324,
"error_subcode": 2069019,
"is_transient": true,
"error_user_title": "Image Required",
"error_user_msg": "Make sure your Page post includes an image that can be used in an ad.",
"fbtrace_id": "AMlEwvLBvptiO2kZc1DRnRN"
}
}
Does anyone have a solution to this problem?
I really appreciate your the answers.

What are these media providers in whatsapp apis?

I have setup a two way communication between business account and customer using whatsapp business apis. I am having trouble understanding media providers that there documentation talks about for sending text message to customer with image/media.
Heres the link to it: https://developers.facebook.com/docs/whatsapp/api/settings/media-providers/
Who are these providers? are they some specified organisation?
I am currently storing the media files in AWS S3 using some pre-signed url method. Can I use media stored in S3 in whatsapp media message?.
An example would be great help.
According to the Whatsapp API media messages documentation, there are two ways of sending an image outbound message:
Send the image by its Media ID
Send the image by its URL
When choosing 2, sending it by its URL, sometimes you may need to setup a Media Provider settings if the images URL you reference is not directly accessible and requires a username/password authentication or even a bearer token. (check https://developers.facebook.com/docs/whatsapp/api/messages).
Sending images by Media ID
To send it by ID, you need first to upload the image file using the POST /v1/media endpoint. That will return the Media-ID (e.g: 456) that you should use to compose the message object on the POST /v1/messages/ endpoint, like this:
{
"to": "1234567",
"type": "image",
"recipient_type": "individual",
"image": {
"caption": "The image caption",
"id": "456"
}
}
Sending images by URL
When sending it by URL, you can simply inform the URL of a image file (e.g.: http://yourcompany.com/images/your_image.png) on the link field of the POST /v1/messages/ endpoint, just like this:
{
"to": "1234567",
"type": "image",
"recipient_type": "individual",
"image": {
"caption": "The image caption",
"link": "http://yourcompany.com/images/your_image.png"
}
}
What if the URL http://yourcompany.com/images/your_image.png is behind some authentication on the server? (username/password ou maybe a bearer token). Then you need first to setup a Media Provider with such credentials, using the POST /v1/settings/application/media/providers endpoint, like this:
[{
"name": "yourcompany-images",
"type": "www",
"config": {
"basic": {
"username": "the-username",
"password": "the-password"
}
}
}
]
Once you have this set up on your API, then you are able to reference this Media Provider by its name on the POST /v1/messages/ endpoint, like this:
{
"to": "1234567",
"type": "image",
"recipient_type": "individual",
"image": {
"caption": "The image caption",
"link": "http://yourcompany.com/images/your_image.png"
"provider": {
"name" : "yourcompany-images"
}
}
}
Using S3 pre-signed URLs as image links
You have to consider that pre-signed URLs are temporary links that will expire after a while. It can work when everything is fine with you Whatsapp API Client and the message is promptly received by the recipient. But if something goes wrong on this chain, maybe the Whatsapp API will try to download the image again later. So keep this in mind and try to create pre-signed URLs with long expiration time (maybe a 7 day expiration link using IAM User as explained here).

Youtube Live API Error in creating a live Broadcast with isDefaultBroadcast=True

I'am using python to create a broadcast with api youtube streaming.
Every day I want to create a schedule video and stream it with the same url access.
So in my code I add isDefaultBroadcast=True
# Create a liveBroadcast resource and set its title, scheduled start time,
# scheduled end time, and privacy status.
def insert_broadcast(youtube, options):
insert_broadcast_response = youtube.liveBroadcasts().insert(
part="snippet,status",
body=dict(
snippet=dict(
title=options.broadcast_title,
isDefaultBroadcast=True,
scheduledStartTime=options.start_time,
scheduledEndTime=options.end_time
),
status=dict(
privacyStatus=options.privacy_status
)
)
).execute()
But i got an error 403
An HTTP error 403 occurred:
{
"error": {
"errors": [
{
"domain": "youtube.liveBroadcast",
"reason": "liveBroadcastBindingNotAllowed",
"message": "The binding is not allowed"
}
],
"code": 403,
"message": "The binding is not allowed"
}
}
I have add isDefaultStream fot the liveStream part and no problem with it.
Any idea what's going wrong ?