Skip to content

Latest commit

 

History

History
75 lines (59 loc) · 3.27 KB

File metadata and controls

75 lines (59 loc) · 3.27 KB

Story Service

Manage stories and reels with the Story Service: create stories/reels, browse story discovery, list a user's reels, update/delete/like reels and read hashtag feeds.

Responses are returned as raw dictionaries (the gateway does not define typed response schemas for these endpoints). All methods are available in both async and _sync variants and are reachable through client.story.<method>() or directly as client.<method>().

Table of Contents

Methods

Method Description Parameters
get_my_stories() Get the current user stories count, active_only, last_id
create_story() Create a story request: CreateStoryBody
get_stories_discovery() Discover stories device_id, city_id, category_ids, next_idx, count, regenerate, skip_impression, refresh
create_reel() Create a reel request: CreateReelBody
get_my_reels() Get the current user reels limit, last_idx, is_confirmed, status_filter
get_user_reels() Get a user's reels user_id, limit, last_idx
update_reel() Update a reel reel_id, request: UpdateReelBody
delete_reel() Delete a reel reel_id
like_reel() Like/unlike a reel reel_id, request: LikeReelBody
get_hashtag_feed() Get a hashtag feed hashtag, count, last_id

Examples

Basic Setup

from basalam_sdk import BasalamClient, PersonalToken
from basalam_sdk.story import CreateStoryBody, CreateReelBody, ReelMetadata, LikeReelBody

auth = PersonalToken(token="your_access_token", refresh_token="your_refresh_token")
client = BasalamClient(auth=auth)

Create a story

async def add_story():
    return await client.story.create_story(
        request=CreateStoryBody(
            photo_id=123456,
            hashtags=["sale", "new"],
            products=[111, 222],
        )
    )

Create and like a reel

async def reels():
    reel = await client.story.create_reel(
        request=CreateReelBody(
            video_id=98765,
            product_ids=[111, 222],
            metadata=ReelMetadata(instagram_reel_id="abc"),
        )
    )
    await client.story.like_reel(reel_id=reel["id"], request=LikeReelBody(like=True))
    return reel

Discovery and hashtag feed

discovery = await client.story.get_stories_discovery(count=10)
feed = await client.story.get_hashtag_feed(hashtag="handmade", count=20)