SendAlbumPostByUrl#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method publishes a carousel - from 2 to 10 files in one post. The files are passed by links; photos and videos can be mixed.
Files
The files have to meet the Instagram requirements - otherwise the post is not published and the reason arrives in the notification.
All the frames of a carousel have one aspect ratio: as in Instagram, it is taken from the first file, the other frames are fitted into it with padding.
A video inside a carousel is not a Reel: it stays an element of the album, not a separate post. A carousel with a video is assembled longer: Instagram transcodes the video before assembling the carousel.
The method uses the limits on the number of requests per second.
Request#
To publish a carousel, you have to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/sendAlbumPostByUrl/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Request parameters#
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
urlFiles | array | Yes | The links to the files of the carousel: from 2 to 10 images or videos |
caption | string | No | The caption of the post. The maximum length is 2200 characters |
disableComments | boolean | No | Publish the carousel with closed comments. The default is false |
Request body example#
Publish a carousel of photos:#
{
"urlFiles": [
"https://example.com/1.jpg",
"https://example.com/2.jpg"
],
"caption": "A carousel"
}
Publish a carousel with a video:#
{
"urlFiles": [
"https://example.com/clip.mp4",
"https://example.com/photo.jpg"
],
"caption": "A carousel"
}
Response#
Response parameters#
| Field | Type | Description |
|---|---|---|
postId | string | The post identifier. The link to it is returned by GetPostInfo |
Response body example#
{
"postId": "2907515653209522683"
}
SendAlbumPostByUrl errors#
For a list of errors common to all methods, refer to the Common errors section
| HTTP code | Error ID | Description |
|---|---|---|
| 400 | Bad Request Validation failed | Validation error |
| 400 | Validation failed. Details: 'urlFiles' must contain at least 2 items | One file or none is passed |
| 400 | Validation failed. Details: 'urlFiles' must contain less than or equal to 10 items | More than ten files are passed |
| 400 | Validation failed. Details: 'urlFiles[0]' must be a valid uri with a scheme matching the http\|https pattern | One of the links is not an http or https address. The number of the file in the list, starting from zero, is in the brackets |
Refusals in the notification#
The command is executed through the queue: the method responds with 200 and postId at once. If the command could not be executed, the outgoingPostStatus notification arrives with status = failed, the reason is in the description field:
description | Description |
|---|---|
uploader answered 400: request was failed with bad status code (404). URL: 'http://example.com/2.jpg' | One of the files is not available at the specified link. The HTTP code of the response of the server that hosts the file is in the brackets |
unsupported file type for instagram post: application/octet-stream | What the link points to is neither an image nor a video of a suitable format |
post upload: video duration 310000 ms is outside 3000 … 60000 | The duration of a video in the carousel is outside the allowed range, in milliseconds |
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/sendAlbumPostByUrl/{{apiTokenInstance}}"
payload = {
"urlFiles": [
"https://example.com/1.jpg",
"https://example.com/2.jpg"
],
"caption": "A carousel"
}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/sendAlbumPostByUrl/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"urlFiles": ["https://example.com/1.jpg", "https://example.com/2.jpg"],
"caption": "A carousel"
}'