### Upload Media Source: https://api.postforme.dev/docs#description/introduction Get a URL to upload media files. ```APIDOC ## Upload Media ### Create Upload URL - **Method**: POST - **Endpoint**: `/v1/media/create-upload-url` #### Request Body (No specific fields mentioned in the source) ``` -------------------------------- ### Get Social Accounts Source: https://api.postforme.dev/docs#description/introduction Fetch a list of connected social accounts for specified platforms. This is useful for retrieving account IDs needed for posting. ```javascript // Step 1: Fetch the social accounts you want to post to. In this case we are getting all facebook and instagram accounts. const socialAccountResponse = await fetch('https://api.postforme.dev/v1/social-accounts?platform=facebook&platform=instagram', { method: 'GET', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' } }); const { data } = await socialAccountResponse.json(); //Grab the ids from the social account response const accountIds = data.map((account) => account.id); ``` -------------------------------- ### Social Account Feeds Operations Source: https://api.postforme.dev/docs#description/introduction Get platform details for any post made under a connected social account. Requires the 'feeds' permission. Supports various platforms and optional expansion of metrics. ```APIDOC ## GET /v1/social-account-feeds/{social_account_id} ### Description Retrieves posts from a social account's feed, including post information and optionally metrics. ### Method GET ### Endpoint /v1/social-account-feeds/{social_account_id} #### Path Parameters - **social_account_id** (string) - Required - The ID of the social account. #### Query Parameters - **expand** (string) - Optional - Use 'metrics' to include metrics information. For Facebook, this is capped by **FacebookFeedMetricsLimitCap** (default: 10). ``` -------------------------------- ### Create Media Upload URL Source: https://api.postforme.dev/docs#description/introduction Use this endpoint to initiate the media upload process by obtaining a URL for uploading media. This is the first step in uploading media files. ```http POST /v1/media/create-upload-url ``` -------------------------------- ### Create and Schedule a Post Source: https://api.postforme.dev/docs#description/introduction Create a new social media post with caption, media, and schedule it for a future time. This requires the social account IDs obtained previously. ```javascript // Step 2: Create the post using the social account ids // We are scheduling the post one hour from now const scheduledAt = new Date(); scheduledAt.setHours(scheduledAt.getHours() + 1); const postResponse = await fetch('https://api.postforme.dev/v1/social-posts', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, body: JSON.stringify({ caption: 'Hello, world!', scheduled_at: scheduledAt, media: [ { "url": "https://picsum.photos/id/237/1080/1080", } ], social_accounts: accountIds, }), }); const postData = await postResponse.json(); ``` -------------------------------- ### Connect a Social Account Source: https://api.postforme.dev/docs#description/introduction Use this snippet to generate an authentication URL for connecting a social media account. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```javascript //Create an auth URL to redirect the user to in order for them to login and connect their account const socialAccountAuthUrlResponse = await fetch('https://api.postforme.dev/v1/social-accounts/auth-url', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, body: JSON.stringify({ platform: 'facebook' }), }); const { url } = await socialAccountAuthUrlResponse.json(); //Redirect to the url from the repsone console.log(url); ``` -------------------------------- ### Social Post Previews Source: https://api.postforme.dev/docs#description/introduction Generate previews for social posts to see how they will appear for each account. ```APIDOC ## Social Post Previews Social Post Previews allow you to see what a Social Post will create for each account in the post. ### Create Social Post Preview - **Method**: POST - **Endpoint**: `/v1/social-post-previews` ``` -------------------------------- ### Shell Curl Request Source: https://api.postforme.dev/docs#description/introduction This snippet shows how to make a request using curl. Ensure you have the correct authentication token and headers set. ```shell curl -X GET \ http://localhost:3000/api/users \ -H 'Accept: application/json' \ -H 'Authorization: Bearer YOUR_TOKEN_HERE' ``` -------------------------------- ### AuthenticationRequired Source: https://api.postforme.dev/docs#description/introduction This section details the authentication requirements for API access, specifically using a Bearer token. ```APIDOC ## AuthenticationRequired ### Description This endpoint requires Bearer token authentication. ### Method Not specified, but typically POST or PUT for operations requiring authentication. ### Endpoint Not specified in the provided text. ### Parameters #### Headers - **accept** (string) - Optional - Value: application/json - **Authorization** (string) - Required - Value: Bearer [Your Token] ### Request Example ```json { "example": "Request body not specified" } ``` ### Response #### Success Response (200) - **field1** (type) - Description #### Response Example ```json { "example": "Response body not specified" } ``` ``` -------------------------------- ### Media Operations Source: https://api.postforme.dev/docs#description/introduction Endpoints for managing media assets that can be attached to posts. These are useful if your media is not already publicly accessible. ```APIDOC ## POST /v1/media/create-upload-url ### Description Creates a pre-signed URL for uploading media assets. ### Method POST ### Endpoint /v1/media/create-upload-url ### Parameters #### Request Body - **filename** (string) - Required - The name of the file to be uploaded. - **contentType** (string) - Required - The MIME type of the file. ### Request Example { "filename": "example.jpg", "contentType": "image/jpeg" } ### Response #### Success Response (200) - **uploadUrl** (string) - The URL to which the media asset should be uploaded. - **mediaUrl** (string) - The final URL of the uploaded media asset once processing is complete. #### Response Example { "uploadUrl": "https://example.com/upload/url", "mediaUrl": "https://example.com/media/asset.jpg" } ``` -------------------------------- ### Webhooks Operations Source: https://api.postforme.dev/docs#description/introduction Operations for managing webhooks. Webhooks allow you to subscribe to events and receive POST requests to your specified URL when those events occur. A secret is provided for security verification. ```APIDOC ## Webhooks Webhooks enable you to subscribe to certain events. This involves Post for Me making a POST request to the URL of any webhooks you create. Only the events you subscribe to will be sent to your webhook URL. ### Payload When an event happens that your webhook is subscribed to, we will make a POST request with the following JSON body: ```json { "event_type": "", "data": {} } ``` The `event_type` will be the event that triggered the webhook POST, `data` will be the resulting entity from the event. ### Security To verify the POST to your webhook URL is from us we will include a secret in the header "Post-For-Me-Webhook-Secret". When you create a webhook you will receive the secret in the response. ### Retries If your server fails to respond with a 2XX code, requests to it will be retried with exponential backoff around 8 times over the course of just over a day. ## Webhooks Operations ### Get All Webhooks - **Method**: GET - **Endpoint**: `/v1/webhooks` ### Create Webhook - **Method**: POST - **Endpoint**: `/v1/webhooks` ### Get Webhook by ID - **Method**: GET - **Endpoint**: `/v1/webhooks/{id}` ### Update Webhook by ID - **Method**: PATCH - **Endpoint**: `/v1/webhooks/{id}` ### Delete Webhook by ID - **Method**: DELETE - **Endpoint**: `/v1/webhooks/{id}` ``` -------------------------------- ### Social Accounts Operations Source: https://api.postforme.dev/docs#description/introduction Endpoints for managing social media accounts used for publishing posts. ```APIDOC ## GET /v1/social-accounts ### Description Retrieves a list of all connected social accounts. ### Method GET ### Endpoint /v1/social-accounts ### Response #### Success Response (200) - **accounts** (array) - A list of social account objects. - **id** (string) - The unique identifier for the social account. - **platform** (string) - The social media platform (e.g., Twitter, LinkedIn). - **username** (string) - The username of the social account. #### Response Example { "accounts": [ { "id": "acc_123", "platform": "Twitter", "username": "@exampleuser" } ] } ``` ```APIDOC ## POST /v1/social-accounts ### Description Connects a new social account. ### Method POST ### Endpoint /v1/social-accounts ### Parameters #### Request Body - **platform** (string) - Required - The social media platform to connect (e.g., Twitter, LinkedIn). - **authCode** (string) - Required - The authorization code obtained from the platform. ### Request Example { "platform": "Twitter", "authCode": "oauth_code_from_twitter" } ### Response #### Success Response (200) - **id** (string) - The unique identifier for the newly connected social account. - **platform** (string) - The social media platform. - **username** (string) - The username of the social account. #### Response Example { "id": "acc_456", "platform": "Twitter", "username": "@newuser" } ``` ```APIDOC ## GET /v1/social-accounts/{id} ### Description Retrieves details for a specific social account. ### Method GET ### Endpoint /v1/social-accounts/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the social account. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the social account. - **platform** (string) - The social media platform. - **username** (string) - The username of the social account. #### Response Example { "id": "acc_123", "platform": "Twitter", "username": "@exampleuser" } ``` ```APIDOC ## PATCH /v1/social-accounts/{id} ### Description Updates an existing social account. Currently, only the username can be updated. ### Method PATCH ### Endpoint /v1/social-accounts/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the social account. #### Request Body - **username** (string) - Optional - The new username for the social account. ### Request Example { "username": "@updateduser" } ### Response #### Success Response (200) - **id** (string) - The unique identifier for the social account. - **platform** (string) - The social media platform. - **username** (string) - The updated username of the social account. #### Response Example { "id": "acc_123", "platform": "Twitter", "username": "@updateduser" } ``` ```APIDOC ## DELETE /v1/social-accounts/{id} ### Description Deletes a connected social account. ### Method DELETE ### Endpoint /v1/social-accounts/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the social account to delete. ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the account was deleted. #### Response Example { "message": "Social account deleted successfully." } ``` ```APIDOC ## POST /v1/social-accounts/auth-url ### Description Generates an authorization URL for connecting a new social account. ### Method POST ### Endpoint /v1/social-accounts/auth-url ### Parameters #### Request Body - **platform** (string) - Required - The social media platform for which to generate the auth URL. ### Request Example { "platform": "Twitter" } ### Response #### Success Response (200) - **authUrl** (string) - The URL to redirect the user to for authorization. #### Response Example { "authUrl": "https://api.twitter.com/oauth/authenticate?oauth_token=..." } ``` ```APIDOC ## POST /v1/social-accounts/{id}/disconnect ### Description Disconnects a previously connected social account. ### Method POST ### Endpoint /v1/social-accounts/{id}/disconnect ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the social account to disconnect. ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the account was disconnected. #### Response Example { "message": "Social account disconnected successfully." } ``` -------------------------------- ### Social Post Results Operations Source: https://api.postforme.dev/docs#description/introduction Retrieve information about the outcome of publishing content to social media platforms, including publication status, errors, and platform URLs. ```APIDOC ## GET /v1/social-post-results ### Description Retrieves a list of social post results. ### Method GET ### Endpoint /v1/social-post-results ## GET /v1/social-post-results/{id} ### Description Retrieves a specific social post result by its ID. ### Method GET ### Endpoint /v1/social-post-results/{id} #### Path Parameters - **id** (string) - Required - The unique identifier of the social post result. ``` -------------------------------- ### Webhook Payload Structure Source: https://api.postforme.dev/docs#description/introduction This is the JSON structure sent in the POST request to your webhook URL when a subscribed event occurs. The 'event_type' indicates the event, and 'data' contains the related entity. ```json { "event_type": "", "data": {} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.