Resolve message attachment
curl --request GET \
--url https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}', 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.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"refreshed": true,
"status": "<string>",
"url": "<string>"
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "never",
"retryable": true,
"type": "<string>"
}
}AIsa Social
Resolve message attachment
Inbox. Read only; needs social:read. Ids are yours: accounts acc_..., profiles prf_..., posts pst_...; every other object id is checked against your accounts before the call.
Resolve one attachment on a message to a media url that works right now.
### Why it exists
Instagram and Facebook sign DM media urls per request and expire them. So the `url` on a message is a snapshot: it works when you read the message and stops working later.
This endpoint checks the stored url and, when it has gone stale, re-mints the message's media from Meta and persists it before answering.
The message id never expires, so this URL is the one to store. It is returned ready-made on each attachment as `refreshUrl` when you read a message over REST.
### Building the URL from a webhook
**Webhook payloads do not carry `refreshUrl`**, so a webhook-driven integration builds this URL itself. Every piece is in the event:
- `message.conversationId`
- `message.platformMessageId`
- the attachment's zero-based position
- `account.accountId`
**`accountId` is a required query parameter**. Omitting it returns `400` `missing_required_field`, which is the same requirement `GET /apis/v1/social/whatsapp/media/{mediaId}` has.
### Response format
- By default it responds `302` to the live media url, so it can be used directly as an `<img src>` on a browser session.
- API-key integrators should pass `?format=json` and read `url` off the body, since a browser cannot attach an Authorization header to an image request.
### Other platforms
Only Instagram and Facebook media can be re-minted. On other platforms the stored url is returned as-is when it still resolves, and `404` otherwise.
<!-- aisa-pricing:start -->
当前未提供请求参考价格;请使用接口支持的报价功能确认费用。 最终费用以账户适用价格及实际结算为准。
<!-- aisa-pricing:end -->
GET
https://api.aisa.one
/
apis
/
v1
/
social
/
inbox
/
conversations
/
{conversationId}
/
messages
/
{messageId}
/
attachments
/
{index}
Resolve message attachment
curl --request GET \
--url https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}', 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.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"refreshed": true,
"status": "<string>",
"url": "<string>"
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "never",
"retryable": true,
"type": "<string>"
}
}请求规范
- 方法与路径: GET /apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}
- 可用状态: enabled
- 请求 URL 模板:
https://api.aisa.one/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index} - conversationId: path; 必填
- messageId: path; 必填
- index: path; 必填
- accountId: query; 必填
- format: query; 可选
- Runtime 事实版本: 99acb5bddbedc8d3352e7c4fef86c3e6d8852c14772bcd18dbcf415237a642bd
{
"operationId": "get_aisa_social_apis_v1_social_inbox_conversation_54bd26",
"method": "GET",
"path": "/apis/v1/social/inbox/conversations/{conversationId}/messages/{messageId}/attachments/{index}",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [
{
"description": "The conversation ID (AIsa id or platform conversation id)",
"in": "path",
"name": "conversationId",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "The message id as returned by the list-messages endpoint (the platform message id)",
"in": "path",
"name": "messageId",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "Zero-based position of the attachment in the message's attachments array",
"in": "path",
"name": "index",
"required": true,
"schema": {
"minimum": 0,
"type": "integer"
}
},
{
"description": "One of your social accounts (acc_...).",
"in": "query",
"name": "accountId",
"required": true,
"schema": {
"pattern": "^acc_[0-9A-Za-z]{22}$",
"type": "string"
}
},
{
"description": "`redirect` (default) answers 302 to the media; `json` returns the url in the body",
"in": "query",
"name": "format",
"required": false,
"schema": {
"default": "redirect",
"enum": [
"redirect",
"json"
],
"type": "string"
}
}
],
"security": [
{
"bearerAuth": []
}
],
"x-aisa-status": "enabled",
"x-aisa-pricing": {
"description": "Included with your connected social accounts: AIsa does not charge per call.",
"kind": "no_customer_charge"
},
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
费用与请求规则
当前未提供请求参考价格;请使用接口支持的报价功能确认费用。 最终费用以账户适用价格及实际结算为准。 公开参考值不是你的账户报价或最终扣费。对于支持 X-AISA-Cost-Mode: quote 的接口,执行前请针对完整请求获取免费报价;执行后通过响应费用元数据和 Usage Logs 核对结算费用。1 USD 等于 1,000,000 个整数 micro-USD。授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
路径参数
The conversation ID (AIsa id or platform conversation id)
The message id as returned by the list-messages endpoint (the platform message id)
Zero-based position of the attachment in the message's attachments array
必填范围:
x >= 0查询参数
One of your social accounts (acc_...).
Pattern:
^acc_[0-9A-Za-z]{22}$redirect (default) answers 302 to the media; json returns the url in the body
可用选项:
redirect, json