Publishing
Create a media container (API key)
Create an Instagram media container with your hmok_ API key. Poll
GET /channels/{ch}/instagram/containers/{containerId} until
status is finished, then publish it. Delivery is at-least-once:
do not retry a request whose response you did not receive without
checking the container’s status first.
POST
/
channels
/
{ch}
/
instagram
/
containers
Create a media container (API key)
curl --request POST \
--url https://api.hookmyapp.com/channels/{ch}/instagram/containers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"imageUrl": "<string>",
"videoUrl": "<string>",
"caption": "<string>",
"coverUrl": "<string>",
"altText": "<string>",
"locationId": "<string>",
"audioName": "<string>",
"shareToFeed": true,
"thumbOffset": 1,
"children": [
{
"imageUrl": "<string>",
"videoUrl": "<string>"
}
],
"userTags": [
{
"username": "<string>",
"x": 123,
"y": 123
}
],
"trialParams": {}
}
'import requests
url = "https://api.hookmyapp.com/channels/{ch}/instagram/containers"
payload = {
"imageUrl": "<string>",
"videoUrl": "<string>",
"caption": "<string>",
"coverUrl": "<string>",
"altText": "<string>",
"locationId": "<string>",
"audioName": "<string>",
"shareToFeed": True,
"thumbOffset": 1,
"children": [
{
"imageUrl": "<string>",
"videoUrl": "<string>"
}
],
"userTags": [
{
"username": "<string>",
"x": 123,
"y": 123
}
],
"trialParams": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
imageUrl: '<string>',
videoUrl: '<string>',
caption: '<string>',
coverUrl: '<string>',
altText: '<string>',
locationId: '<string>',
audioName: '<string>',
shareToFeed: true,
thumbOffset: 1,
children: [{imageUrl: '<string>', videoUrl: '<string>'}],
userTags: [{username: '<string>', x: 123, y: 123}],
trialParams: {}
})
};
fetch('https://api.hookmyapp.com/channels/{ch}/instagram/containers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hookmyapp.com/channels/{ch}/instagram/containers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'imageUrl' => '<string>',
'videoUrl' => '<string>',
'caption' => '<string>',
'coverUrl' => '<string>',
'altText' => '<string>',
'locationId' => '<string>',
'audioName' => '<string>',
'shareToFeed' => true,
'thumbOffset' => 1,
'children' => [
[
'imageUrl' => '<string>',
'videoUrl' => '<string>'
]
],
'userTags' => [
[
'username' => '<string>',
'x' => 123,
'y' => 123
]
],
'trialParams' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hookmyapp.com/channels/{ch}/instagram/containers"
payload := strings.NewReader("{\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\",\n \"caption\": \"<string>\",\n \"coverUrl\": \"<string>\",\n \"altText\": \"<string>\",\n \"locationId\": \"<string>\",\n \"audioName\": \"<string>\",\n \"shareToFeed\": true,\n \"thumbOffset\": 1,\n \"children\": [\n {\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\"\n }\n ],\n \"userTags\": [\n {\n \"username\": \"<string>\",\n \"x\": 123,\n \"y\": 123\n }\n ],\n \"trialParams\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hookmyapp.com/channels/{ch}/instagram/containers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\",\n \"caption\": \"<string>\",\n \"coverUrl\": \"<string>\",\n \"altText\": \"<string>\",\n \"locationId\": \"<string>\",\n \"audioName\": \"<string>\",\n \"shareToFeed\": true,\n \"thumbOffset\": 1,\n \"children\": [\n {\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\"\n }\n ],\n \"userTags\": [\n {\n \"username\": \"<string>\",\n \"x\": 123,\n \"y\": 123\n }\n ],\n \"trialParams\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hookmyapp.com/channels/{ch}/instagram/containers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\",\n \"caption\": \"<string>\",\n \"coverUrl\": \"<string>\",\n \"altText\": \"<string>\",\n \"locationId\": \"<string>\",\n \"audioName\": \"<string>\",\n \"shareToFeed\": true,\n \"thumbOffset\": 1,\n \"children\": [\n {\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\"\n }\n ],\n \"userTags\": [\n {\n \"username\": \"<string>\",\n \"x\": 123,\n \"y\": 123\n }\n ],\n \"trialParams\": {}\n}"
response = http.request(request)
puts response.read_body{
"channelId": "<string>",
"containerId": "<string>"
}{
"statusCode": 403,
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}{
"statusCode": 403,
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}{
"statusCode": 403,
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}{
"statusCode": 403,
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}Use
Authorization: Bearer hmok_... (an API key, or a dashboard session) instead of a channel token. Accepted scope is channel.manage.
Delivery is at-least-once: don’t automatically retry after an ambiguous failure (timeout, dropped connection). Check the container’s status first to see whether it was already created.
Create the container, poll its status until finished, then publish. Videos and reels can take minutes; a publish on a container that is still processing answers 409 and can be retried.
If you need the raw Graph request, see the hmat_ gateway twin.Authorizations
Body
application/json
⌘I
Create a media container (API key)
curl --request POST \
--url https://api.hookmyapp.com/channels/{ch}/instagram/containers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"imageUrl": "<string>",
"videoUrl": "<string>",
"caption": "<string>",
"coverUrl": "<string>",
"altText": "<string>",
"locationId": "<string>",
"audioName": "<string>",
"shareToFeed": true,
"thumbOffset": 1,
"children": [
{
"imageUrl": "<string>",
"videoUrl": "<string>"
}
],
"userTags": [
{
"username": "<string>",
"x": 123,
"y": 123
}
],
"trialParams": {}
}
'import requests
url = "https://api.hookmyapp.com/channels/{ch}/instagram/containers"
payload = {
"imageUrl": "<string>",
"videoUrl": "<string>",
"caption": "<string>",
"coverUrl": "<string>",
"altText": "<string>",
"locationId": "<string>",
"audioName": "<string>",
"shareToFeed": True,
"thumbOffset": 1,
"children": [
{
"imageUrl": "<string>",
"videoUrl": "<string>"
}
],
"userTags": [
{
"username": "<string>",
"x": 123,
"y": 123
}
],
"trialParams": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
imageUrl: '<string>',
videoUrl: '<string>',
caption: '<string>',
coverUrl: '<string>',
altText: '<string>',
locationId: '<string>',
audioName: '<string>',
shareToFeed: true,
thumbOffset: 1,
children: [{imageUrl: '<string>', videoUrl: '<string>'}],
userTags: [{username: '<string>', x: 123, y: 123}],
trialParams: {}
})
};
fetch('https://api.hookmyapp.com/channels/{ch}/instagram/containers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hookmyapp.com/channels/{ch}/instagram/containers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'imageUrl' => '<string>',
'videoUrl' => '<string>',
'caption' => '<string>',
'coverUrl' => '<string>',
'altText' => '<string>',
'locationId' => '<string>',
'audioName' => '<string>',
'shareToFeed' => true,
'thumbOffset' => 1,
'children' => [
[
'imageUrl' => '<string>',
'videoUrl' => '<string>'
]
],
'userTags' => [
[
'username' => '<string>',
'x' => 123,
'y' => 123
]
],
'trialParams' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hookmyapp.com/channels/{ch}/instagram/containers"
payload := strings.NewReader("{\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\",\n \"caption\": \"<string>\",\n \"coverUrl\": \"<string>\",\n \"altText\": \"<string>\",\n \"locationId\": \"<string>\",\n \"audioName\": \"<string>\",\n \"shareToFeed\": true,\n \"thumbOffset\": 1,\n \"children\": [\n {\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\"\n }\n ],\n \"userTags\": [\n {\n \"username\": \"<string>\",\n \"x\": 123,\n \"y\": 123\n }\n ],\n \"trialParams\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hookmyapp.com/channels/{ch}/instagram/containers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\",\n \"caption\": \"<string>\",\n \"coverUrl\": \"<string>\",\n \"altText\": \"<string>\",\n \"locationId\": \"<string>\",\n \"audioName\": \"<string>\",\n \"shareToFeed\": true,\n \"thumbOffset\": 1,\n \"children\": [\n {\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\"\n }\n ],\n \"userTags\": [\n {\n \"username\": \"<string>\",\n \"x\": 123,\n \"y\": 123\n }\n ],\n \"trialParams\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hookmyapp.com/channels/{ch}/instagram/containers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\",\n \"caption\": \"<string>\",\n \"coverUrl\": \"<string>\",\n \"altText\": \"<string>\",\n \"locationId\": \"<string>\",\n \"audioName\": \"<string>\",\n \"shareToFeed\": true,\n \"thumbOffset\": 1,\n \"children\": [\n {\n \"imageUrl\": \"<string>\",\n \"videoUrl\": \"<string>\"\n }\n ],\n \"userTags\": [\n {\n \"username\": \"<string>\",\n \"x\": 123,\n \"y\": 123\n }\n ],\n \"trialParams\": {}\n}"
response = http.request(request)
puts response.read_body{
"channelId": "<string>",
"containerId": "<string>"
}{
"statusCode": 403,
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}{
"statusCode": 403,
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}{
"statusCode": 403,
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}{
"statusCode": 403,
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}