> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Node.js NPM

> Social API NPM Package के साथ अपने Node ऐप में Ayrshare API को integrate करें

## अवलोकन

Ayrshare का [Social API NPM Package](https://www.npmjs.com/package/social-media-api) आपको Ayrshare API को अपने Node.js ऐप में integrate करने की अनुमति देता है।

### स्थापना

यदि आप server-side पर Node का उपयोग करते हैं तो Social API NPM Package इंस्टॉल करें।
यह package RESTful कॉल्स को wrap करके कॉल्स को सरल बनाता है।

```bash theme={"system"}
npm i social-media-api
```

<Info>[Ayrshare Dashboard](https://app.ayrshare.com/) में अपनी गुप्त API Key प्राप्त करें।</Info>

### सामान्य उपयोग

Post, History और Delete के उदाहरण:

<Info>
  **X/Twitter पर पोस्ट कर रहे हैं?** 31 मार्च 2026 से, Ayrshare के माध्यम से X/Twitter operations के लिए आपकी अपनी X Developer App credentials की आवश्यकता होगी — Ayrshare हर X-लक्षित कॉल पर इसे लागू करता है। अपनी request में 2 BYO headers जोड़ें। विवरण के लिए [setup guide](/dashboard/connect-social-accounts/x-twitter-byo-keys) देखें।
</Info>

v1.3.0 के अनुसार SDK में एक `setTwitterByo(apiKey, apiSecret)` helper शामिल है जो प्रत्येक बाद की request पर दो आवश्यक `X-Twitter-OAuth1-*` headers को अटैच करता है:

```javascript theme={"system"}
const SocialPost = require("social-media-api");
const social = new SocialPost(API_KEY)
  .setTwitterByo(MY_X_API_KEY, MY_X_API_SECRET);

await social.post({
  post: "Hello from BYO",
  platforms: ["twitter"]
});
```

headers को हटाने के लिए `clearTwitterByo()` का उपयोग करें — एक ही SDK instance को कई tenants के बीच पुनः उपयोग करते समय उपयोगी:

```javascript theme={"system"}
social.clearTwitterByo().setTwitterByo(nextTenant.key, nextTenant.secret);
```

```javascript theme={"system"}
const SocialPost = require("social-media-api");
const API_KEY = "API KEY"; // get an API Key at ayrshare.com
const social = new SocialPost(API_KEY);

const run = async () => {
  /** post */
  const post = await social
    .post({
      post: "One more time",
      platforms: ["twitter", "facebook", "linkedin"],
      profileKey: "DJKJDK-SKDJKDJF" // used with a User Profile
    })
    .catch(console.error);
  console.log(post);

  /** history */
  const history = await social.history().catch(console.error);
  console.log(history);

  /** delete */
  const deletePost = await social.delete({ id: post.id }).catch(console.error);
  console.log(deletePost);
};

run();
```

### Social Media API NPM Package का वीडियो अवलोकन

<div class="video-container">
  <iframe width="560" height="315" src="https://www.youtube.com/embed/OMtj2h6sW6U" title="Social Media API NPM Package" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />
</div>

एक API के माध्यम से सोशल मीडिया पर पोस्ट करें

### Profile Key

आप POST के body में या GET की query में `profileKey` फ़ील्ड के साथ User Profile के लिए Profile Key निर्दिष्ट कर सकते हैं।

### Social API Demo

एक Sample Node.js integration (RESTful API कॉल्स का उपयोग करते हुए) के लिए, GitHub रिपॉजिटरी देखें:

<Card title="Social API Demo Code" icon="github" href="https://github.com/ayrshare/social-api-demo" horizontal>
  Social API Demo एक वेब application है जो उपयोगकर्ताओं को एक साथ कई सोशल मीडिया platforms पर content
  compose, schedule और पोस्ट करने की अनुमति देता है।
</Card>

### अधिक जानकारी और Documentation

<ul class="custom-bullets">
  <li>[NPM Package](https://www.npmjs.com/package/social-media-api)</li>
  <li>[Github Repository](https://github.com/ayrshare/social-media-api)</li>
  <li>[Issue Discussion](https://github.com/ayrshare/social-media-api/issues)</li>
</ul>
