You can create posts with spoilers using the Threads API. Spoilers can be added to text in a post or can be used with media types like images and videos.
This document covers:
media_type of IMAGE, VIDEO or CAROUSEL.To create a text post with a spoiler, use the text_entities parameter. This parameter takes in a list of entity_type, offset, and length values. Each entry represents part of the text post where the spoiler will be applied.
| Name | Description |
|---|---|
string | Indicates the kind of Values: |
int | The starting position of the spoiler. Values: Positive whole numbers (0, 1, 2, etc.) |
int | The length of the spoiler text starting from the Values: Positive whole numbers (1, 2, etc.) |
To create a post with spoilers for media objects (i.e., image, video), use the is_spoiler_media parameter.
| Name | Description |
|---|---|
Boolean | Indicates if the media should be a spoiler or not. Values: |
Spoilers for single Threads posts need to be provided during the media container creation phase.
text_entities parameter.is_spoiler_media parameter. text_entities and is_spoiler_media parameters.curl -i -X POST \
-d "access_token=<ACCESS_TOKEN>" \
-d "media_type=TEXT" \
-d "text=<TEXT>" \
-d "text_entities=[
{
"entity_type": "SPOILER",
"offset": 0,
"length": 2
},
{
"entity_type": "SPOILER",
"offset": 2,
"length": 7
}
]" \
"https://graph.threads.net/v1.0/<THREADS_USER_ID>/threads"
curl -i -X POST \ -d "access_token=<ACCESS_TOKEN>" \ -d "media_type=IMAGE" \ -d "image_url=<IMAGE_URL>" \ -d "text=<TEXT>" \ -d "is_spoiler_media=true" \ "https://graph.threads.net/v1.0/<THREADS_USER_ID>/threads"
curl -i -X POST \
-d "access_token=<ACCESS_TOKEN>" \
-d "media_type=IMAGE" \
-d "image_url=<IMAGE_URL>" \
-d "text=<TEXT>" \
-d "is_spoiler_media=true" \
-d "text_entities=[
{
"entity_type": "SPOILER",
"offset": 0,
"length": 2
},
{
"entity_type": "SPOILER",
"offset": 2,
"length": 7
}
]" \
"https://graph.threads.net/v1.0/<THREADS_USER_ID>/threads"
If the API call is successful, the Threads media container ID will be returned.
You can now publish using the returned Threads media container ID to create your single Threads post with spoilers.
Create a media container for each of the items to be included in the carousel.
Spoilers for Threads carousel posts need to be provided during the carousel container creation phase.
text_entities parameter.is_spoiler_media parameter. text_entities and is_spoiler_media parameters.Note: If is_spoiler_media is set to true all attached media (i.e., images and videos) will be marked as spoilers.
curl -i -X POST \
-d "access_token=<ACCESS_TOKEN>" \
-d "media_type=CAROUSEL" \
-d "children=<MEDIA_ID_1>,<MEDIA_ID_2>,<MEDIA_ID_3>" \
-d "text=<TEXT>" \
-d "text_entities=[
{
"entity_type": "SPOILER",
"text": "spoiler",
"offset": 0,
"length": 2
},
{
"entity_type": "SPOILER",
"text": "spoiler",
"offset": 2,
"length": 7
}
]" \
"https://graph.threads.net/v1.0/<THREADS_USER_ID>/threads"
curl -i -X POST \ -d "access_token=<ACCESS_TOKEN>" \ -d "media_type=CAROUSEL" \ -d "children=<MEDIA_ID_1>,<MEDIA_ID_2>,<MEDIA_ID_3>" \ -d "is_spoiler_media=true" \ "https://graph.threads.net/v1.0/<THREADS_USER_ID>/threads"
curl -i -X POST \
-d "access_token=<ACCESS_TOKEN>" \
-d "media_type=CAROUSEL" \
-d "children=<MEDIA_ID_1>,<MEDIA_ID_2>,<MEDIA_ID_3>" \
-d "text=<TEXT>" \
-d "is_spoiler_media=true" \
-d "text_entities=[
{
"entity_type": "SPOILER",
"text": "spoiler",
"offset": 0,
"length": 2
},
{
"entity_type": "SPOILER",
"text": "spoiler",
"offset": 2,
"length": 7
}
]" \
"https://graph.threads.net/v1.0/<THREADS_USER_ID>/threads"
If the API call is successful, the Threads media container ID will be returned.
You can now publish using the returned Threads media container ID to create your Threads carousel post with spoilers.