The Actions endpoint allows you to retrieve action links from your Storyteller tenant. Action links provide interactive elements that can be used within stories and clips.
{"actions":[{"id":"action-link-external-id","title":"Visit Our Website"},{"id":"newsletter-signup","title":"Subscribe to Newsletter"}],"pageSize":10,"currentPage":1,"totalPages":1}
{"status":404,"type":"https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.4","title":"Not Found","detail":"Action with externalId action-001 not found","instance":""}
constfetch=require('node-fetch');asyncfunctiongetActions(searchText='',currentPage=1,pageSize=10,sort=''){constparams=newURLSearchParams({...(searchText&&{searchText}),currentPage:currentPage.toString(),pageSize:pageSize.toString(),...(sort&&{sort})});try{constresponse=awaitfetch(`https://integrations.usestoryteller.com/api/actions?${params}`,{method:'GET',headers:{'x-storyteller-api-key':process.env.STORYTELLER_API_KEY}});if(!response.ok){consterrorData=awaitresponse.json();thrownewError(`HTTP ${response.status}: ${errorData.detail}`);}constdata=awaitresponse.json();returndata;}catch(error){console.error('Error fetching actions:',error);throwerror;}}// Usage examplesasyncfunctionexamples(){// Get all actionsconstallActions=awaitgetActions();console.log(`Found ${allActions.actions.length} actions`);// Search for specific actionsconstsearchResults=awaitgetActions('newsletter',1,20);console.log(`Found ${searchResults.actions.length} actions matching "newsletter"`);// Get actions sorted alphabeticallyconstsortedActions=awaitgetActions('',1,50,'AlphabeticalAsc');console.log(`Retrieved ${sortedActions.actions.length} sorted actions`);// Get action IDs for workflow usageconstactionIds=allActions.actions.map(action=>action.id);console.log('Available action IDs:',actionIds);}
importrequestsimportosfromurllib.parseimporturlencodedefget_actions(search_text='',current_page=1,page_size=10,sort=''):url='https://integrations.usestoryteller.com/api/actions'headers={'x-storyteller-api-key':os.environ.get('STORYTELLER_API_KEY')}params={'currentPage':current_page,'pageSize':page_size}ifsearch_text:params['searchText']=search_textifsort:params['sort']=sorttry:response=requests.get(url,headers=headers,params=params)response.raise_for_status()data=response.json()returndataexceptrequests.exceptions.RequestExceptionase:print(f'Error fetching actions: {e}')ifhasattr(e.response,'json'):print(f'Error details: {e.response.json()}')raise# Usage examplestry:# Get all actionsall_actions=get_actions()print(f'Found {len(all_actions["actions"])} actions')# Search for specific actionssearch_results=get_actions(search_text='newsletter',page_size=20)print(f'Found {len(search_results["actions"])} actions matching "newsletter"')# Get actions sorted alphabeticallysorted_actions=get_actions(page_size=50,sort='AlphabeticalAsc')print(f'Retrieved {len(sorted_actions["actions"])} sorted actions')# Extract action IDs for workflow usageaction_ids=[action['id']foractioninall_actions['actions']]print('Available action IDs:',action_ids)exceptExceptionase:print(f'Failed to fetch actions: {e}')
usingSystem;usingSystem.Net.Http;usingSystem.Threading.Tasks;usingSystem.Collections.Generic;usingNewtonsoft.Json;publicclassActionsClient{privatereadonlyHttpClient_httpClient;privatereadonlystring_baseUrl="https://integrations.usestoryteller.com";publicActionsClient(stringapiKey){_httpClient=newHttpClient();_httpClient.DefaultRequestHeaders.Add("x-storyteller-api-key",apiKey);}publicasyncTask<ActionsResponse>GetActionsAsync(stringsearchText="",intcurrentPage=1,intpageSize=10,stringsort=""){try{varqueryParams=newList<string>{$"currentPage={currentPage}",$"pageSize={pageSize}"};if(!string.IsNullOrEmpty(searchText)){queryParams.Add($"searchText={Uri.EscapeDataString(searchText)}");}if(!string.IsNullOrEmpty(sort)){queryParams.Add($"sort={sort}");}varqueryString=string.Join("&",queryParams);varresponse=await_httpClient.GetAsync($"{_baseUrl}/api/actions?{queryString}");response.EnsureSuccessStatusCode();varresponseContent=awaitresponse.Content.ReadAsStringAsync();varactions=JsonConvert.DeserializeObject<ActionsResponse>(responseContent);returnactions;}catch(HttpRequestExceptionex){thrownewException($"Error fetching actions: {ex.Message}",ex);}}}publicclassActionsResponse{publicActionItem[]Actions{get;set;}publicintPageSize{get;set;}publicintCurrentPage{get;set;}publicintTotalPages{get;set;}}publicclassActionItem{publicstringId{get;set;}publicstringTitle{get;set;}}// Usagevarclient=newActionsClient(Environment.GetEnvironmentVariable("STORYTELLER_API_KEY"));try{// Get all actionsvarallActions=awaitclient.GetActionsAsync();Console.WriteLine($"Found {allActions.Actions.Length} actions");// Search for specific actionsvarsearchResults=awaitclient.GetActionsAsync("newsletter",1,20);Console.WriteLine($"Found {searchResults.Actions.Length} actions matching 'newsletter'");// Get actions sorted alphabeticallyvarsortedActions=awaitclient.GetActionsAsync("",1,50,"AlphabeticalAsc");Console.WriteLine($"Retrieved {sortedActions.Actions.Length} sorted actions");// Extract action IDs for workflow usagevaractionIds=allActions.Actions.Select(a=>a.Id).ToArray();Console.WriteLine($"Available action IDs: {string.Join(",", actionIds)}");}catch(Exceptionex){Console.WriteLine($"Error: {ex.Message}");}
# Get all actions (first page)curl-XGET"https://integrations.usestoryteller.com/api/actions"\-H"x-storyteller-api-key: your-api-key-here"# Search for specific actionscurl-XGET"https://integrations.usestoryteller.com/api/actions?searchText=newsletter&pageSize=20"\-H"x-storyteller-api-key: your-api-key-here"# Filter by external IDcurl-XGET"https://integrations.usestoryteller.com/api/actions?externalId=action-001"\-H"x-storyteller-api-key: your-api-key-here"# Get a specific action by external IDcurl-XGET"https://integrations.usestoryteller.com/api/actions/action-001"\-H"x-storyteller-api-key: your-api-key-here"# Get actions sorted alphabeticallycurl-XGET"https://integrations.usestoryteller.com/api/actions?sort=AlphabeticalAsc&pageSize=50"\-H"x-storyteller-api-key: your-api-key-here"
Action links can be referenced in workflow metadata when creating interactive content:
// 1. Get available actionsconstactionsData=awaitgetActions();constavailableActionIds=actionsData.actions.map(action=>action.id);// 2. Use action ID in workflow metadataconstworkflowMetadata={'https://example.com/video.mp4':{'Title':'Interactive Video','actionLinkId':availableActionIds[0]// Use first available action}};// 3. Execute workflow with action metadataawaitexecuteWorkflow(['create-interactive-clip'],['https://example.com/video.mp4'],workflowMetadata);
asyncfunctiongetAllActions(){letallActions=[];letcurrentPage=1;lettotalPages=1;do{constresponse=awaitgetActions('',currentPage,50);allActions.push(...response.actions);totalPages=response.totalPages;currentPage++;}while(currentPage<=totalPages);returnallActions;}// UsageconstallActions=awaitgetAllActions();console.log(`Retrieved ${allActions.length} total actions`);
{"status":401,"type":"https://datatracker.ietf.org/doc/html/rfc7235#section-3.1","title":"Unauthorized","detail":"No valid API key provided","instance":""}
{"status":400,"type":"https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.1","title":"Bad Request","detail":"Invalid page size. Must be between 1 and 100","instance":""}