Set presence
Learn how to set Instagram presence with Unipile API.
To set the presence of the linked Instagram account, use Set Presence and provide the desired presence value.
await messagingApi.setPresence({
path: {
account_id: "acc_123456789",
},
body: {
presence: "online",
},
});messaging_api.set_presence(
"acc_123456789",
{"presence": "online"},
)curl --request POST \
--url https://api.unipile.com/v2/account_id/presence \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"presence": "online"
}
'Use offline to clear the online presence when needed.
Read another user's presence
Use Get a User Presence with the provider user ID to retrieve current presence. This differs from Set Presence, which publishes the connected account's own presence. Handle unknown when the provider shares no presence information.
Instagram and WhatsApp do not report the account owner's presence. Instagram only shares another user's presence when the connected account shares its own activity status. Visibility also depends on provider privacy settings.
const response = await fetch(
"https://api.unipile.com/v2/acc_123456789/users/user_id/presence",
{
method: "GET",
headers: {
"X-API-KEY": "YOUR_API_KEY",
},
},
);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();import requests
response = requests.get(
"https://api.unipile.com/v2/acc_123456789/users/user_id/presence",
headers={"X-API-KEY": "YOUR_API_KEY"},
timeout=30,
)
response.raise_for_status()
data = response.json()curl --request GET \
--url "https://api.unipile.com/v2/acc_123456789/users/user_id/presence" \
--header 'X-API-KEY: YOUR_API_KEY'Updated 12 days ago
Did this page help you?