{"id":15021066,"url":"https://github.com/ayrshare/social-media-api","last_synced_at":"2025-05-16T01:06:21.115Z","repository":{"id":41863811,"uuid":"292929947","full_name":"ayrshare/social-media-api","owner":"ayrshare","description":"Social Media API: Automate Posting and Analytics to Social Networks like Instagram, TikTok, X/Twitter, Facebook, LinkedIn, Reddit, YouTube, and Telegram","archived":false,"fork":false,"pushed_at":"2024-12-16T04:49:43.000Z","size":509,"stargazers_count":205,"open_issues_count":1,"forks_count":31,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-15T08:11:30.142Z","etag":null,"topics":["api","facebook","facebook-api","instagram","instagram-api","linkedin","linkedin-api","nodejs","reddit","social-api","social-media","social-media-api","social-network","social-networks","telegram","tiktok","tiktok-api","youtube","youtube-api"],"latest_commit_sha":null,"homepage":"https://www.ayrshare.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ayrshare.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-04T19:25:21.000Z","updated_at":"2025-05-13T14:18:32.000Z","dependencies_parsed_at":"2024-05-03T21:41:04.415Z","dependency_job_id":"6de0b4ca-09d2-4781-bfc3-533d3b92adb5","html_url":"https://github.com/ayrshare/social-media-api","commit_stats":{"total_commits":47,"total_committers":4,"mean_commits":11.75,"dds":"0.34042553191489366","last_synced_commit":"12cf532b8320408518cd006aa186e13228589f6b"},"previous_names":["ayrshare/social-media-api","ayrshare/social-post-api"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayrshare%2Fsocial-media-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayrshare%2Fsocial-media-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayrshare%2Fsocial-media-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayrshare%2Fsocial-media-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ayrshare","download_url":"https://codeload.github.com/ayrshare/social-media-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448579,"owners_count":22072764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","facebook","facebook-api","instagram","instagram-api","linkedin","linkedin-api","nodejs","reddit","social-api","social-media","social-media-api","social-network","social-networks","telegram","tiktok","tiktok-api","youtube","youtube-api"],"created_at":"2024-09-24T19:56:05.697Z","updated_at":"2025-05-16T01:06:16.093Z","avatar_url":"https://github.com/ayrshare.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Social Media APIs for Posting, Scheduling, and Analytics\n\n![Ayrshare logo](https://www.ayrshare.com/wp-content/uploads/2020/08/ayr-logo-2156-reduced.png)\n\nThe Social Media API is a Node.js wrapper SDK for [Ayrshare's APIs](https://www.ayrshare.com).\n\nAyrshare is a powerful set of APIs that enable you to send social media posts, get analytics, and add comments to *X/Twitter*, *Instagram*, *Facebook*, *LinkedIn*, *YouTube*, *Google Business Profile*, *Pinterest*, *TikTok*, *Reddit*, and *Telegram* on behalf of your users or clients.\n\nThe Ayrshare Social API handles all the setup and maintenance for the social media networks. One API to rule them all (yeah, went there). See the full list of [full list of features](https://www.ayrshare.com/docs/apis/overview) in our docs.\n\nGet started with a [free plan](https://www.ayrshare.com/pricing), or if you have a platform or manage multiple users check out the [Business Plan](https://www.ayrshare.com/business-plan-for-multiple-users/).\n\nFor more information on setup, see our installation [video](https://youtu.be/G8M6DZdtcMc) or our [Quick Start Guide](https://www.ayrshare.com/docs/quickstart).\n\n## Installation\n\n`npm i social-media-api`\n\n## Setup\n\n**1.** Create a free [Ayrshare account](https://app.ayrshare.com).\n\n   ![alt Social Accounts Setup](https://www.ayrshare.com/wp-content/uploads/Ayrshare-login.png)\n\n**2.** Enable your social media accounts such as X/Twitter, Facebook, LinkedIn, Reddit, Instagram, Google Business Profile, Telegram, TikTok, or YouTube in the Ayrshare dashboard.\n\n   ![alt Social Accounts Setup](https://www.ayrshare.com/wp-content/uploads/Ayrshare-social-linking.png)\n  \n**3.** Copy your API Key from the Ayrshare dashboard. Used for authentication.\n\n   ![alt API Key](https://www.ayrshare.com/wp-content/uploads/Ayrshare-API-key.png)\n\n## Getting Started\n\n### Initialize Social Post API\n\nCreate a new Social Media API object with your API Key.\n\n``` javascript\nconst SocialMediaAPI = require(\"social-media-api\"); // or import SocialMediaAPI from 'social-media-api';\nconst social = new SocialMediaAPI('Your API Key');\n```\n\n### History, Post, Delete Example\n\nThis simple example shows how to post an image or video, get history, and delete the post. This example assumes you have a free API key from [Ayrshare](https://www.ayrshare.com) and have enabled X/Twitter, Facebook Pages, Instagram, LinkedIn. Note, YouTube, Google Business Profile, Telegram, TikTok, and Reddit also available.\n\n``` javascript\nconst SocialMediaAPI = require(\"social-media-api\");\nconst API_KEY = \"Your API Key\"; // get an API Key at ayrshare.com\nconst social = new SocialMediaAPI(API_KEY);\n\nconst run = async () =\u003e {\n  /** post */\n  const post = await social.post({\n    post: \"Who you gonna call?\",\n    platforms: [\"twitter\", \"facebook\", \"fbg\", \"instagram\", \"linkedin\", \"gmb\"],\n    mediaUrls: [\"https://img.ayrshare.com/012/gb.jpg\"]\n  }).catch(console.error);\n  console.log(post);\n\n  /** history */\n  const history = await social.history()\n     .catch(console.error);\n  console.log(history);\n\n  /** delete */\n  const deletePost = await social.delete({ id: post.id })\n     .catch(console.error);\n  console.log(deletePost);\n};\n\nrun();\n```\n\n## Social Media API\n\nThe following section details the different functions of the social media API.\n\n### Post\n\nPublished a new post to the specified social networks either immediately or at scheduled future date. Returns a promise that resolves to an object containing the post ID and post status (success, error). See the [post endpoint](https://www.ayrshare.com/docs/apis/post/post) for the full capabilities.\n\n``` javascript\nconst postResponse = await social.post({\n    // Required\n    post: \"Best post ever!\",\n\n    /** \n     * Required: Social media platforms to post. \n     * Accepts an array of strings with values: \"facebook\", \"twitter\", \"instagram\", \"linkedin\", \"youtube\", \"gmb\", \"reddit\", or \"telegram\".\n     * YouTube requires a video and not shown in the example. See https://www.ayrshare.com/docs/apis/post/social-networks/youtube\n     */\n    platforms: [\"twitter\", \"facebook\", \"fbg\", \"instagram\", \"linkedin\", \"gmb\", \"telegram\"],\n\n    // Optional: URLs of images or videos to include in the post\n    mediaUrls: [\"https://img.ayrshare.com/012/gb.jpg\"],\n\n    // Optional: Datetime to schedule a future post. \n    // Accepts an ISO-8601 UTC date time in format \"YYYY-MM-DDThh:mm:ssZ\". Example: 2021-07-08T12:30:00Z\n    scheduleDate: \"2020-08-07T15:17:00Z\",\n\n    // Optional: Shorten links in the post for all platforms similar to bit.ly.\n    // Only URLS starting with http or https will be shortened. Default value: true.\n    shortenLinks: true,\n\n    // Optional for Business Plans, otherwise remove\n    profileKeys: [\"Profile API Key 1\"];\n  }).catch(console.error);\n```\n\n### Delete\n\nDelete a post with a given post ID, obtained from the \"post\" response. Returns a promise with the delete status. Also, can bulk delete multiple IDs at once using the \"bulk\" key. See the [delete endpoint](https://www.ayrshare.com/docs/apis/post/delete-post) for more details.\n\n``` javascript\nconst deleteResponse = await social.delete({\n    id: \"POST ID\",                          // optional, but required if \"bulk\" not present\n    bulk: [\"Post ID 1\", \"Post ID 2\", ...]   // optional, but required if \"id\" not present\n  }).catch(console.error);\n```\n\n### Get Post\n\nGet a post with a given post ID, obtained from the \"post\" response. Returns a promise that resolves to an array containing the post object. See the [get endpoint](https://www.ayrshare.com/docs/apis/post/get-post) for more details.\n\n``` javascript\nconst getResponse = await social.getPost({ id }).catch(console.error);\n```\n\n### Retry Post\n\nRetry a failed post with a given post ID, obtained from the \"post\" response. Returns a promise that resolves to an object containing the post status and ID. See the [retry endpoint](https://www.ayrshare.com/docs/apis/post/retry-post) for more details.\n\n``` javascript\nconst retryResponse = await social.retryPost({ id }).catch(console.error);\n```\n\n### History\n\nGet a history of all posts and their current status in descending order. Returns a promise that resolves to an array of post objects. See the [history endpoint](https://www.ayrshare.com/docs/apis/history/get-history) for more details.\n\n``` javascript\nconst historyResponse = await social.history({\n  lastRecords: 10,    // optional: returns the last X number of history records\n  lastDays: 30,       // optional: returns the last X number of days of history records. Defaults to 30 if not present.\n}).catch(console.error);\n```\n\nGet history by post ID. See the [history by ID endpoint](https://www.ayrshare.com/docs/apis/history/get-history-id) for more details.\n\n``` javascript\nconst historyByIdResponse = await social.history({\n  id: \"pK0j89\" // required: Ayrshare top level post ID\n}).catch(console.error);\n```\n\nGet history by platform. See the [history by platform endpoint](https://www.ayrshare.com/docs/apis/history/history-platform) for more details.\n\n``` javascript\nconst historyAllPostsResponse = await social.history({\n  platform: \"facebook\"\n}).catch(console.error);\n```\n\n### Upload Media\n\nUpload and store a new image. Returns a URL referencing the image. Can be used in \"image_url\" in \"post\". See the [media endpoint](https://www.ayrshare.com/docs/apis/media/upload-media) for more details.\n\n``` javascript\nconst uploadResponse = await social.upload({\n    // Required: The image as a Base64 encoded string. Example encoding: https://www.base64-image.de/\n    file:\"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...\",\n\n    // Optional\n    fileName: \"test.png\",\n\n    // Optional\n    description: \"best image\"\n}).catch(console.error);\n```\n\n### Get Media\n\nGet all media URLS. Returns a promise that resolves to an array of URL objects. See the [media endpoint](https://www.ayrshare.com/docs/apis/media/get-media-in-gallery) for more details.\n\n``` javascript\nconst mediaResponse = await social.media().catch(console.error);\n```\n\n### Get Media Upload URL for Large Files\n\nGet a URL to upload large files. Returns a promise that resolves to an object containing an access URL and an upload URL. See the [media upload url endpoint](https://www.ayrshare.com/docs/apis/media/upload-large-media) for more details.\n\n``` javascript\nconst mediaUploadResponse = await social.mediaUploadUrl({ \n    fileName: \"test.png\", // required: The name of the file to upload\n    contentType: \"image/png\" // required: The content type of the file\n}).catch(console.error);\n```\n\n### Verify Media Exists\n\nVerify that the media file exists when uploaded. See the [media verify exists endpoint](https://www.ayrshare.com/docs/apis/media/verify-media-url) for more details.\n\n``` javascript\nconst verifyMediaResponse = await social.verifyMediaExists({\n    mediaUrl: \"https://theImage.jpg\" // required: URL of the image to verify exists\n}).catch(console.error);\n```\n\n### Resize Image\n\nGet image resized according to social network requirements. See the [resize image endpoint](https://www.ayrshare.com/docs/apis/media/resize) for more details.\n\n``` javascript\nconst resizeImageResponse = await social.resizeImage({\n    imageUrl: \"https://theImage.jpg\", // required: URL of the image to resize\n    platform: \"facebook\" // required: Platform to resize the image for. \n    watermarkUrl: \"https://theWatermark.png\", // optional: URL of the watermark image to add to the image.\n    effects: { color: \"#A020F0\" } // optional: Change opacity, colors, etc. See endpoint for more details.\n    dimensions: { width: 1200, height: 628 } // optional: Width and height of the image. Required if platform is not specified.\n    mode: \"blur\" // optional. See endpoint for more details.\n}).catch(console.error);\n```\n\n### User\n\nGet data about the logged in user, such as post quota, used quota, active social networks, and created date. See the [user endpoint](https://www.ayrshare.com/docs/apis/user/profile-details) for more details.\n\n``` javascript\nconst user = await social.user().catch(console.error);\n```\n\n### Post Analytics\n\nGet analytics on shortened links and shares, likes, shares, and impressions for a post or at the accounts level. See the [post analytics endpoint](https://www.ayrshare.com/docs/apis/analytics/post) for more details.\n\n``` javascript\nconst analyticsPost = await social.analyticsPost({\n  id: \"Post ID\",\n  platforms: [\"twitter\", \"instagram\", \"facebook\", \"youtube\", \"linkedin\"]\n}).catch(console.error);\n```\n\n### Social Media Analytics\n\nGet analytics and demographics on a user’s social profile, such as impressions, views, and followers. See the [social analytics endpoint](https://www.ayrshare.com/docs/apis/analytics/social) for more details.\n\n``` javascript\nconst analyticsSocial = await social.analyticsSocial({\n  platforms: [\"twitter\", \"instagram\", \"facebook\", \"youtube\", \"pinterest\", \"tiktok\", \"reddit\", \"linkedin\"]\n}).catch(console.error);\n```\n\n### Post a Comment\n\nAdd a comment to a post. Currently only on Facebook and Instagram. See the [create comment endpoint](https://www.ayrshare.com/docs/apis/comments/post-comment) for more details.\n\n``` javascript\nconst postCommentResponse = await social.postComment({\n    id: \"Pkdo9sjk2\", // required: Post top-level ID.\n    platforms: [\"instagram\", \"facebook\"], // required: List of platforms to add comments. Currently available platforms: [\"facebook\", \"instagram\"]\n    comment: \"What a comment\" //required: Text of the new comment to add to the post.\n  }).catch(console.error);\n```\n\n### Get Comments\n\nGet comments for a post. Currently only on Facebook and Instagram. See the [get comment endpoint](https://www.ayrshare.com/docs/apis/comments/get-comments) for more details.\n\n``` javascript\nconst getCommentResponse = await social.getComments({\n    id: \"Pkdo9sjk2\", // required: Post top-level ID.\n  }).catch(console.error);\n```\n\n### Delete Comments\n\nDelete either a single comment or all comments under a post that were sent via Ayrshare. Available for Facebook, Instagram, LinkedIn, Reddit, TikTok, X/Twitter, and YouTube. See the [delete comment endpoint](https://www.ayrshare.com/docs/apis/comments/delete-comments) for more details.\n\n``` javascript\nconst deleteCommentResponse = await social.deleteComments({\n    id: \"Pkdo9sjk2\", // required: Post top-level ID or social comment ID\n    platforms: [\"instagram\", \"facebook\"], // optional: Required only if using the social comment id.\n  }).catch(console.error);\n```\n\n### Reply Comment\n\nReply to a comment. Available for Facebook, Instagram, LinkedIn, TikTok, X/Twitter, and YouTube. See the [reply comment endpoint](https://www.ayrshare.com/docs/apis/comments/reply-to-comment) for more details.\n\n``` javascript\nconst replyCommentResponse = await social.replyComment({\n    commentId: \"Pkdo9sjk2\", // required: The Ayrshare commentId returned from the POST comment endpoint. Be sure to use the top level commentId.\n    platforms: [\"instagram\", \"facebook\"], // required: Array of platforms to post the reply. Values: facebook, instagram, linkedin, tiktok, twitter, youtube\n    comment: \"What a comment\" // required: The reply to add to the comment.\n  }).catch(console.error);\n```\n\n### Set, Delete, and List Auto Schedule\n\nAuto scheduling allows you to create and manage pre-defined posting schedules. See the [auto-schedule endpoints](https://www.ayrshare.com/docs/apis/auto-schedule/overview) for more details.\n\n``` javascript\nconst setAutoSchedule = await social.setAutoSchedule({\n  schedule: [\"13:05Z\", \"20:14Z\"],   // required\n  title: \"Instagram Schedule\"       // optional \n}).catch(console.error);\n```\n\n``` javascript\nconst deleteAutoSchedule = await social.deleteAutoSchedule({\n  title: \"Instagram Schedule\" // optional, else default is used\n}).catch(console.error);\n```\n\n``` javascript\nconst listAutoSchedule = await social.listAutoSchedule().catch(console.error);\n```\n\n### Add an RSS or Substack Feed\n\nAdd a new RSS or Substack feed to auto post all new articles. Returns a promise that resolved to an object containing the feed ID. See [How to Automate Your Blog or Newsletter](https://www.ayrshare.com/how-to-automatically-post-your-blog-or-newsletter-to-social-media/) for more info.\n\n``` javascript\nconst feedResponse = await social.feedAdd({\n    url: \"https://theRSSFeed\", // required: URL to shorten\n\n    // Optional: Value: \"rss\" or \"substack\". \n    // If not set, defaults to \"rss\"\n    type: \"RSS\",\n  }).catch(console.error);\n```\n\n### Delete an RSS or Substack Feed\n\nDelete an RSS feed for a given ID. See the [delete feed endpoint](https://www.ayrshare.com/docs/apis/feeds/delete-feed) for more details.\n\n``` javascript\nconst feedResponse = await social.feedDelete({\n    id: \"Feed ID\", // required: ID of the feed\n  }).catch(console.error);\n```\n\n### Get Feeds\n\nGet all registered RSS feeds. Returns a promise that resolves to an array of feed objects. See the [get feeds endpoint](https://www.ayrshare.com/docs/apis/feeds/get-feeds) for more details.\n\n``` javascript\nconst feedsResponse = await social.feedGet().catch(console.error);\n```\n\n### Update Feed\n\nUpdate an RSS feed for a given ID. Returns a promise that resolves to an object containing the feed ID. See the [update feed endpoint](https://www.ayrshare.com/docs/apis/feeds/update-feed) for more details.\n\n``` javascript\nconst feedResponse = await social.feedUpdate({\n    id: \"Feed ID\", // required: ID of the feed\n    useFirstImage: true, // optional: Use the first image in the article to add to the post.\n    autoHashtag: true, // optional: Automatically add hashtags to the post.\n  }).catch(console.error);\n```\n\n## Business Functions for Multiple Users - Business or Enterprise Plan Required\n\nThe [Business Plan](https://www.ayrshare.com/business-plan-for-multiple-users/) allows you to create, manage, and post on behalf of client profiles via the API or Dashboard GUI. You can [integrate](https://www.ayrshare.com/docs/multiple-users/business-plan-overview) Ayrshare into your platform, product, or agency and give your clients social media capabilites. Please [contact us](mailto:contact@ayrshare.com) with any questions.\n\nA User Profile PROFILE_KEY can be set with the `setProfileKey` function.\n\n``` javascript\nconst social = new SocialMediaAPI(API_KEY);\nsocial.setProfileKey(PROFILE_KEY);\n```\n\nReplace PROFILE_KEY with the Profile Key of the user you want to use.\n\nPlease see the [Authorization](https://www.ayrshare.com/docs/apis/overview#authorization) docs for more details.\n\n### Create Profile\n\nCreate a new account profile under the primary account. See the [create profile endpoint](https://www.ayrshare.com/docs/apis/profiles/create-profile) for more details.\n\n``` javascript\nconst createProfileResponse = await social.createProfile({\n    // Required: title\n    title: \"New Profile Title\",\n  }).catch(console.error);\n```\n\n### Delete Profile\n\nDelete a profile owned by the primary account. See the [delete profile endpoint](https://www.ayrshare.com/docs/apis/profiles/delete-profile) for more details.\n\n``` javascript\nconst deleteProfileResponse = await social.deleteProfile({\n    // Required: profileKey - the API Key of the profile to delete\n    profileKey: \"JI9s-kJII-9283-OMKM\",\n  }).catch(console.error);\n```\n\n### Update Profile\n\nUpdate a profile owned by the primary account. See the [update profile endpoint](https://www.ayrshare.com/docs/apis/profiles/update-profile) for more details.\n\n``` javascript\nconst updateProfileResponse = await social.updateProfile({\n    // Required: profileKey - the API Key of the profile to update\n    profileKey: \"JI9s-kJII-9283-OMKM\",\n    title: \"This is a greate new title\"\n  }).catch(console.error);\n```\n\n### Get Profiles\n\nGet all the profiles associated with the primary account. See the [get profile endpoint](https://www.ayrshare.com/docs/apis/profiles/get-profiles) for more details.\n\n``` javascript\nconst getProfileResponse = await social.getProfiles().catch(console.error);\n```\n\n### Unlink Social Network\n\nUnlink a social account for a given user profile owned by the primary account. See the [unlink social network endpoint](https://www.ayrshare.com/docs/apis/profiles/unlink-social-network) for more details.\n\n``` javascript\nconst unlinkResponse = await social.unlinkSocial({\n    // Required: profileKey - the API Key of the profile to delete\n    profileKey: \"JI9s-kJII-9283-OMKM\",\n    platform: \"facebook\"\n  }).catch(console.error);\n```\n\n### Generate a JWT Url\n\nGenerate a JWT Token and URL used for authorizing a user's access to the Social Account linking page. See the [generate JWT endpoint](https://www.ayrshare.com/docs/apis/profiles/generate-jwt) for more details.\n\n``` javascript\nconst generateJWTResponse = await social.generateJWT({\n    domain: \"ACME\", // required\n    privateKey: \"-----BEGIN RSA PRIVATE KEY...\", // required\n    profileKey: \"PROFILE_KEY\", // required\n}).catch(console.error);\n```\n\n### Get Brand Info on a User\n\nGet brand information on users and companies public social media accounts. See the [brand endpoint](https://www.ayrshare.com/docs/apis/brand/brand-user) for more details.\n\n``` javascript\nconst brandResponse = await social.getBrandByUser({\n    platforms: [\"instagram\", \"facebook\"],\n    instagramUser: \"@ayrshare\",\n    facebookUser: \"ayrshare\",\n  }).catch(console.error);\n```\n\n### Register, Unregister, and List Webhooks\n\nA webhook allows you to be notified when certain system actions occur via a call to a URL you provide. Register a webhook by providing your URL and the type of action you wish to be notified. When the action occurs a POST message will be sent to the provided URL. See the [webhooks endpoints](https://www.ayrshare.com/docs/apis/webhooks/overview) for more details.\n\n``` javascript\nconst registerWebhook = await social.registerWebhook({\n    action: \"social\", // required: Available actions: \"feed\", \"social\".\n    url: \"https://myhook\", // required: Your URL to be called on action. URL must be in a valid format and begin with https://\n}).catch(console.error);\n```\n\n``` javascript\nconst unregisterWebhook = await social.unregisterWebhook({\n    action: \"social\", // required: Available actions: \"feed\", \"social\".\n}).catch(console.error);\n```\n\n``` javascript\nconst listWebhooks = await social.listWebhooks().catch(console.error);\n```\n\n### Auto Hashtags\n\nAutomatically add hashtags to your post. See the [auto hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/auto-hashtags) for more details.\n\n``` javascript\nconst autoHashtagsResponse = await social.autoHashtags({\n    post: \"I love social media\", // required: Post text to add hashtags for.\n    position: \"auto\" // optional: Position of the hashtags. Values: \"auto\", \"end\". Default: \"auto\".\n    max: 2 // optional: Maximum number of hashtags to add, ranging 1-5. Default: 2.\n}).catch(console.error);\n```\n\n### Recommend Hashtags\n\nGet suggestions for hashtags based on a keyword. See the [recommend hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/recommend-hashtags) for more details.\n\n``` javascript\nconst recommendHashtagsResponse = await social.recommendHashtags({\n    keyword: \"social media\", // required: Keyword to get hashtags for.\n}).catch(console.error);\n```\n\n### Check Banned Hashtags\n\nCheck if a hashtag is banned on Instagram or other social networks. See the [check banned hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/check-hashtags) for more details.\n\n``` javascript\nconst checkBannedHashtagsResponse = await social.checkBannedHashtags({\n    hashtag: \"socialmedia\", // required: Hashtag to check.\n}).catch(console.error);\n```\n\n### Get All Reviews\n\nRetrieve all the reviews for the specified platform. See the [get all reviews endpoint](https://www.ayrshare.com/docs/apis/reviews/get-reviews) for more details.\n\n``` javascript\nconst allReviewsResponse = await social.reviews({\n    platform: \"facebook\", // required: Platform to get reviews for. Currently available: \"facebook\", \"gmb\"\n}).catch(console.error);\n```\n\n### Get Single Review\n\nRetrieve a single review. See the [get single review endpoint](https://www.ayrshare.com/docs/apis/reviews/get-one-review) for more details.\n\n``` javascript\nconst singleReviewResponse = await social.review({\n    id: \"Review ID\", // required\n    platform: \"gmb\", // required: Platform to get review for. Currently available: \"gmb\"\n}).catch(console.error);\n```\n\n### Reply to Review\n\nReply to a review. See the [reply to review endpoint](https://www.ayrshare.com/docs/apis/reviews/reply-review) for more details.\n\n``` javascript\nconst replyReviewResponse = await social.replyReview({\n    reviewId: \"Review ID\", // required: Review ID to reply to.\n    platform: \"facebook\", // required: Platform to reply to review for. Currently available: \"facebook\", \"gmb\"\n    reply: \"Thank you for the review\" // required: Text of the reply to the review.\n}).catch(console.error);\n```\n\n### Delete Review Reply\n\nDelete a review reply. See the [delete review reply endpoint](https://www.ayrshare.com/docs/apis/reviews/delete-review-reply) for more details.\n\n``` javascript\nconst deleteReplyReviewResponse = await social.deleteReplyReview({\n    reviewId: \"Review ID\", // required: Review ID to delete reply for.\n    platform: \"gmb\", // required: Platform to delete reply for. Currently available: \"gmb\"\n}).catch(console.error);\n```\n\n## Max Pack Required\n\n### Generate Post\n\nGenerate a new social post using ChatGPT. Token limits applicable. See the [generate post endpoint](https://www.ayrshare.com/docs/apis/generate/post-text) for more details.\n\n``` javascript\nconst generatePostResponse = await social.generatePost({\n    text: \"I love social media\", // required: Description of what the post should be about. \n    hashtags: true, //optional: Include hashtags in the post. Default: true\n    emojis: true, // optional: Include emojis in the post. Default: false\n    twitter: true, // optional: Construct a post 280 or few characters. Default: false\n}).catch(console.error);\n```\n\n### Generate Rewrite\n\nGenerate variations of a social media post using ChatGPT. Token limits applicable. See the [generate rewrite endpoint](https://www.ayrshare.com/docs/apis/generate/rewrite-post) for more details.\n\n``` javascript\nconst generateRewriteResponse = await social.generateRewrite({\n    post: \"I love social media\", // required: The post text to be rewritten. \n    emojis: true, // optional: Include emojis in the post. Default: false\n    hashtags: true, // optional: Include hashtags in the post. Default: false\n    twitter: true, // optional: Construct a post 280 or few characters. Default: false\n    rewrites: 5, // optional: Number of rewrites to generate. Default: 5\n}).catch(console.error);\n```\n\n### Generate Transcription\n\nProvide a transcription of a video file. See the [generate transcription endpoint](https://www.ayrshare.com/docs/apis/generate/transcribe-video) for more details.\n\n``` javascript\nconst generateTranscriptionResponse = await social.generateTranscription({\n    videoUrl: \"https://theVideo.mp4\", // required: URL encoded video URL. The video must be hosted by Ayrshare.\n}).catch(console.error);\n```\n\n### Generate Translation\n\nTranslate text for a post to over 100 different languages. See the [generate translation endpoint](https://www.ayrshare.com/docs/apis/generate/translate-post) for more details.\n\n``` javascript\nconst generateTranslationResponse = await social.generateTranslation({\n    text: \"I love social media\", // required: The text to be translated.\n    lang: \"es\", // required: The language code to translate the text to. \n}).catch(console.error);\n```\n\n### Generate Alt Text\n\nCreate AI-generated alt text for your images.  See the [generate alt text endpoint](https://www.ayrshare.com/docs/apis/generate/image-alt-text) for more details.\n\n``` javascript\nconst generateAltTextResponse = await social.generateAltText({\n    url: \"https://theImage.jpg\", // required: URL of the image to generate alt text for.\n    keywords: [\"social media\", \"ayrshare\"], // optional: Keywords to help the AI generate better alt text.\n    lang: \"en\" // optional: The language code to generate the alt text in. Default: \"en\"\n}).catch(console.error);\n```\n\n### Shorten link\n\nProvide a URL and a shortened link will be returned. See the [shorten link endpoint](https://www.ayrshare.com/docs/apis/links/create-short-link) for more details.\n\n``` javascript\nconst shortenLinkResponse = await social.shortLink({\n    url: \"https://theURL.com\", // required: URL to shorten.\n    utmId: \"1234\", // optional: UTM ID to track the link. See more details about utm parameters at endpoint link above.\n    utmSource: \"source\", // optional\n    utmMedium: \"medium\", // optional\n    utmCampaign: \"campaign\", // optional\n    utmTerm: \"term\", // optional\n    utmContent: \"content\", // optional\n}).catch(console.error);\n```\n\n### Analytics for Shortened Links\n\nReturn analytics for all shortened links or a single link for a given link ID. See the [analytics link endpoint](https://www.ayrshare.com/docs/apis/links/link-analytics) for more details.\n\n``` javascript\nconst analyticsLinkResponse = await social.shortLinkAnalytics({\n    id: \"Link ID\", // optional: Link ID to get analytics for.\n    fromCreatedDate: \"2023-07-08T12:30:00Z\", // optional: Get history of links shortened after this date.\n    toCreatedDate: \"2023-07-08T12:30:00Z\", // optional: Get history of links shortened before this date.\n    fromClickDate: \"2023-07-08T12:30:00Z\", // optional: Get history of links clicked after this date.\n    toClickDate: \"2023-07-08T12:30:00Z\", // optional: Get history of links clicked before this date.\n}).catch(console.error);\n```\n\n## Other Packages \u0026 Integrations\n\nWe have other package and integrations such as [Python](https://www.ayrshare.com/docs/packages-guides/python), [Bubble.io](https://www.ayrshare.com/docs/packages-guides/bubble), and [Airtable](https://www.ayrshare.com/docs/packages-guides/airtable) + examples in PHP and Go.\n\n## Additional Information and Support\n\nAdditional examples, responses, etc. can be found at:\n\n[RESTful API Endpoint Docs](https://www.ayrshare.com/docs/apis/overview)\n\nSee our [changelog](https://www.ayrshare.com/docs/whatsnew/latest) for the latest and greatest.\n\nPlease [contact us](mailto:support@ayrshare.com) with your questions, or just to give us shout-out 📢!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayrshare%2Fsocial-media-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayrshare%2Fsocial-media-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayrshare%2Fsocial-media-api/lists"}