مقالات

نحوه ارسال حلقه های فیس بوک با استفاده از API برای رسانه های اجتماعی


اگر فیلم های اجتماعی بوده اید ، شکل های کوتاه در لحظه های تصویری معمولاً از 3 ثانیه تا 60 ثانیه داغ هستند که به صورت عمودی بر روی تلفن شما نمایش داده می شوند. از زمانی که Tiktok تمایل به فیلم های کوتاه شکل را آغاز کرده است ، هر رقیب رسانه های اجتماعی نسخه خاص خود را ایجاد کرده است. اینستاگرام با درام در اینستاگرام ، یوتیوب با شورت در یوتیوب و اخیراً قرقره های فیس بوکنه تنها این ، شبکه ها نیز مشغول به روزرسانی ادغام API خود با فیلم های کوتاه شکل بودند: API اینستاگرام ، API Tiktok و YouTube API. همه به استثنای فیس بوک ، یعنی متا … تاکنون با API جدید در قرقره های فیس بوک.

قرقره در فیس بوک چیست

Reals Facebook Reals در سپتامبر 2021 آغاز شد ، پاسخ به فیلم های کوتاه Tiktok است. همانطور که فیس بوک می گوید:

قرقره های فیس بوک می توانند از موسیقی ، صوتی ، جلوه ها و موارد دیگر تشکیل شوند. می توانید آنها را در یک خبرنامه یا گروهی پیدا کنید ، و هنگام تماشای ماکارا در فیس بوک ، می توانید با اظهار نظر در مورد آن یا به اشتراک گذاری آن با دوستان ، به راحتی خالق را مستقیماً از این ویدئو دنبال کنید.

قرقره ها نیازهای ویدیویی منحصر به فردی دارند:

  • مدت زمان: تا 60 ثانیه و بیش از 3 ثانیه.
  • قالب: فیلم MP4 (.mp4).
  • در صورت وجود حداقل 1080p و 4K (توجه: فیلم پس از بارگذاری به 720p محدود می شود)
  • انتخاب جنبه: 9:16.

ایجاد قرقره های فیس بوک به همان سادگی است که یک ویدیو را در تلفن همراه خود ضبط می کنید. در مثال طبل های زیر ، شکل 9:16 ، یعنی. ضبط شده بر روی تلفن همراه.

فیس بوک همچنین بر کمک به سازندگان برای تولید درآمد با قرقره های فیس بوک خود جایزه پاداش کسب کرد. چقدر پول می توانید کسب کنید؟ به طور کلی ، اگر بیش از 100000 بازدید به مدت 30 روز داشته باشید ، ماهانه 4000 دلار درآمد کسب خواهید کرد. علاوه بر این ، “چالش” برای کسب درآمد اضافی وجود دارد.

API برای رسانه های اجتماعی در فیس بوک

به تازگی ، API Graphics Facebook فرصتی را برای به اشتراک گذاشتن مستقیم فیلم های درام از طریق API خود برای ارسال طبل ارائه داد. قبل از آن ، شما فقط می توانید با استفاده از برنامه iOS یا Android ، بستر فیس بوک را به اشتراک بگذارید ، اما اکنون می توانید مستقیماً در API API API آنها ارسال کنید.

دو مرحله قبل از استفاده از API در FB API وجود دارد:

  1. API فیس بوک از نقاط پایانی معمولی OAuth با نشانه ها برای ارسال مجوز استفاده می کند. OAuth به کاربران اجازه می دهد تا مجوزهای برنامه شما را تأیید و ارائه دهند. این نشانه ها کوتاه هستند ، اما می توانند برای نشانگرهای صفحه طولانی مدت رد و بدل شوند. اگرچه ما عمیقاً شیرجه نخواهیم داد ، توجه به این نکته مهم است که فقط می توانید درام را در صفحات فیس بوک ارسال کنید. ارسال طبل در حساب های شخصی یا صفحات گروهی توسط فیس بوک مجاز نیست.
  2. فیس بوک از شما خواسته است تا درخواست تأیید کرده و از طریق فرآیند بررسی API و دسترسی به مجوز بروید (pages_show_list. ، pages_read_engagementوت pages_manage_posts مجوز) که می تواند چند روز تا چند هفته طول بکشد. ابتدا باید برنامه/ادغام خود را ایجاد کنید ، یک فیلم استفاده را ضبط کنید و توجیهی را برای مجوزها از طریق پورتال توسعه دهنده فیس بوک بنویسید. انتظار می رود چند بار اول رد شود.

API در قرقره های فیس بوک

خوب اکنون برای چیزهای سرگرم کننده … بیایید سعی کنیم از API در FB API برای ارسال ویدیو استفاده کنیم.

سه مرحله برای ادغام API در فیس بوک برای ارسال یک حلقه ویدیویی کوتاه شکل وجود دارد. در اینجا یک ویدیوی مثال وجود دارد که ما ارسال خواهیم کرد.

به عنوان مثال Facebook Makara برای ارسال

ارسال حلقه API مرحله 1

با تماس بارگذاری ویدیو را اولیه کنید video_reels نقطه پایان پاسخ یک شناسه ویدیویی و URL بارگذاری است.

GET https://graph.facebook.com/{page-id}/video_reels

پارامترهای درخواست مورد نیاز عبارتند از:

  • upload_phase=start
  • access_token={access_token}

او {page-id} وت {access_token} شماره شناسایی صفحه فیس بوک و نشانگر دسترسی به ترتیب در هنگام OAUTH ارائه شده است.

در اینجا مثالی در JavaScript آورده شده است:

const uploadStartUri = `https://graph.facebook.com/${page_id}/video_reels?upload_phase=start&access_token=${access_token}`;

const initiateUploadResponse = await fetch(uploadStartUri, { method: "POST" })
    .then((res) => res.json())
    .catch((err) =>
      console.log("Error initiating upload for FB Reels:", uploadStartUri, err)
    );

const { video_id, upload_url } = initiateUploadResponse;

پاسخ به initiateUploadResponseکه در مرحله 2 استفاده خواهد شد:

{
 "video_id": "{video-id}",
 "upload_url": "https://rupload.facebook.com/video-upload/v13.0/{video-id}",
}  

قرقره برای ارسال در مرحله 2

مرحله بعدی بارگذاری ویدیوی واقعی است. دو روش وجود دارد: یک فایل محلی مانند برنامه/OCTE-POT بارگذاری کنید یا برای URL ویدیویی خارجی را در دسترس قرار دهید. ما بر دسترسی خارجی به روش URL تمرکز خواهیم کرد.

با استفاده از پاسخ از مرحله 1 ، با شناسه ویدیویی ، URL و یک نشانگر دسترسی ، برای URL درخواست کنید.

 POST https://rupload.facebook.com/video-upload/{video-id}

به زیر دامنه مختلف توجه کنید rupload به جای معمولی graph زیر دامنه

پارامترهای مورد نیاز پست عبارتند از:

  • هدر Authorization: "Oauth {access_token}"
  • هدر file_url: {url}

کجا access_token همان نشانگر دسترسی در بالا و url URL ویدیویی خارجی شما در دسترس است.

در اینجا مثالی در JavaScript آورده شده است:

const options = {
    method: "POST",
    maxBodyLength: Infinity,
    headers: {
      Authorization: `OAuth ${access_token}`,
      file_url: url,
    },
  };

const uploadResponse = await fetch(upload_url, options)
    .then((res) => res.json())
    .catch((err) =>
      console.error(
        "Error uploading binary for Facebook Reels",
        upload_url,
        options,
        err
      )
    );

اگر همه چیز موفقیت آمیز باشد ، جواب ناخوشایند است:

{"success": true}

قرقره برای ارسال در مرحله 3

ما تقریبا آماده هستیم اکنون این ویدئو باید ارسال شود که نیاز به تماس نهایی دارد.

POST https://graph.facebook.com/{page-id}/video_reels

پارامترهای مورد نیاز پست عبارتند از:

  • access_token={access_token}
  • video_id={video_id}
  • upload_phase="finish"
  • video_state="PUBLISHED"
  • description="The video description text"
  • title="Video title" (اختیاری)

بیایید یک نمونه را دوباره در JavaScript ببینیم:

const title = "Super Title";
const description = "Best Reel ever";
const basePublishReelsURI = `https://graph.facebook.com/${
    auth.id
  }/video_reels?upload_phase=finish&video_id=${video_id}title=${title}&description=${description}&video_state=PUBLISHED&access_token=${access_token}`;

const publishReelsResponse = await fetch(basePublishReelsURI, {
    method: "POST",
  })
    .then((res) => res.json())
    .catch((err) =>
      console.error("Error publishing for Facebook Reels:", basePublishReelsURI, err)
    );

باز هم ، اگر همه چیز موفق است ، جواب بی پروا است:

{"success": true}

حلقه شما قبلاً ارسال شده است!

جایزه تماس API

اگر می خواهید وضعیت قرقره را بررسی کنید – اگر خطایی را ایجاد کنید ، هنوز پردازش یا کاملاً منتشر شده است – می توانید با نقطه انتهایی وضعیت تماس بگیرید:

GET https://graph.facebook.com/{video-id}?fields=status

جایگزین برای API در فیس بوک

جایگزینی برای ادغام مستقیم با API در فیس بوک ، API برای رسانه های اجتماعی Ayrshare است که شامل ادغام API Facebook Reels است. شما دیگر نیازی به تأیید یا نگرانی در مورد جزئیات API فیس بوک ندارید.

به عنوان مثال ، برای ارسال ویدیوی جدید Facebook Reels ، از کد JavaScript زیر با /Post Endpoint استفاده کنید. حتماً API_KEY را با کلید خود از داشبورد جایگزین کنید:

const data = {
    "post": "The description of the video",
    "platforms": ["facebook"],
    "mediaUrls": "https://img.ayrshare.com/012/reel.mp4",
    "faceBookOptions": {
        "reels": true,
        "title": "Super title for the Reel" // optional
    }
};

const requestOptions = {
  method: 'POST',
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify(data)
};

fetch("https://app.ayrshare.com/api/post", requestOptions)
  .then(res => res.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

یا اگر در پایتون ترجیح می دهید:

import requests

payload = {'post': 'Today is a great day!', 
        'platforms': ['facebook'],
        'mediaUrls': ['https://img.ayrshare.com/012/reel.mp4']},
        'faceBookOptions': {
           'reels': true,
           'title': 'Super title for the Reel'
        }
headers = {'Content-Type': 'application/json', 
        'Authorization': 'Bearer API_KEY'}

r = requests.post('https://app.ayrshare.com/api/post', 
    json=payload, 
    headers=headers)
    
print(r.json())

این کار با کمک Ayrshare بسیار آسان است.

API در Facebook Analytics

علاوه بر ارسال طبل های کوتاه ویدیویی فیس بوک ، ممکن است شما همچنین می خواهید تجزیه و تحلیل فیس بوک برای کاربر یا پست های فردی ، مانند چند بازدید ، اشتراک یا لایک. این دیدگاه ها در مورد رفتار ، تعامل و دامنه کاربران می تواند به ساخت استراتژی رسانه های اجتماعی شما کمک کند.

به عنوان مثال ، برای به دست آوردن تجزیه و تحلیل سطح کاربر در تمام فیلم های فیس بوک خود ، با نقطه پایانی API Eyrshare /Analytics تماس بگیرید. در اینجا کد JavaScript است:

const data = { platforms: ["facebook"] };

const requestOptions = {
  method: 'POST',
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify(data)
};

fetch("https://app.ayrshare.com/api/analytics/social", requestOptions)
  .then(res => res.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

یا با تجزیه و تحلیل ها در پایتون تماس بگیرید:

import requests

payload = {'platforms': ['facebook']}
headers = {'Content-Type': 'application/json', 
        'Authorization': 'Bearer API_KEY'}

r = requests.post('https://app.ayrshare.com/analytics/social', 
    json=payload, 
    headers=headers)
    
print(r.json())

تجزیه و تحلیل دقیق فیس بوک مانند پیروان ، لایک ها ، جمعیت شناسی و موارد دیگر بازگردانده می شود.

{
    "facebook": {
        "analytics": {
            "about": "What to watch next? Create private groups with your friends to get recommendations on the next movie or show to watch.",
            "birthday": "11/20/1985",       // Applicable to Pages representing people
            "emails": ["[email protected]"],
            "engagement": {
                "count": 587,
                "socialSentence": "587 people like this."
            },
            "fanCount": 587,
            "followersCount": 587,
            "id": "102619320979033",
            "link": "https://www.facebook.com/102619320979033",
            "location": {
                "street": "142 W 57th St",
                "zip": "10019"
            }
            "name": "theGoodone",
            "pageConsumptions": 11,               // The number of times people clicked on any of your content.
            "pageConsumptionsByConsumptionType": {
                "link clicks": 3,
                "other clicks": 4,
                "video play": 4
            },
            "pageEngagedUsers": 1234,            // The number of people who engaged with your Page. Engagement includes any click.
            "pageFansByLikeSource": {},          // Daily: This is a breakdown of the number of Page likes from the most common places where people can like your Page. (Total Count)
            "pageFansByLikeSourceUnique": {},    // Daily: The number of people who liked your Page, broken down by the most common places where people can like your Page. (Unique Users)
            "pageFansCity": {                    // Lifetime: Aggregated Facebook location data, sorted by city (top 50), about the people who like your Page. (Unique Users)
                "Seattle, United States of America": 1,
                "Ras al-Khaimah, United Arab Emirates": 1,
                "Mexico City, Mexica": 1,
                ...
            },
            "pageFansCountry": {        // Lifetime: Aggregated Facebook location data, sorted by country (top 50), about the people who like your Page. (Unique Users)
                "BD": 1,
                "EG": 1,
                 ...
            },
            "pageFansGenderAge": {     // Lifetime: Aggregated demographic data about the people who like your Page based on the age and gender information they provide in their user profiles. (Unique Users)
                "M.25-34": 92,
                "F.13-17": 1,
                "M.55-64": 1,
                ...
            },
            "pageFansLocale": {        // Lifetime: Aggregated language data about the people who like your Page based on the default language setting selected when accessing Facebook. (Unique Users)
                "bn_IN": 3,
                "es_LA": 6,
                "pa_IN": 1,
                ...
            },
            "pageFanRemoves": 1,              // Unlikes of your Page.
            "pageImpressions": 160,           // The number of times any content from your Page or about your Page entered a person's screen. This includes posts, stories, ads, as well other content or information on your Page.
            "pageImpressionsPaid": 23,        // The number of times any post or story content from your Page or about your Page entered a person's screen through paid distribution such as an ad.
            "pagePostEngagements": 20,        // The number of times people have engaged with your posts through reactions, comments, shares and more.
            "pagePostsImpressions": 124,      // The number of times your Page's posts entered a person's screen. Posts include statuses, photos, links, videos and more.
            "pagePostsImpressionsPaid": 34,   // The number of times your Page's posts entered a person's screen through paid distribution such as an ad.
            "pageVideoViewTime": 10232,       // The total time, in milliseconds, people viewed your Page's video.
            "pageVideoViews": 31,             // The number of times your Page's videos played for at least 3 seconds, or for nearly their total length if they're shorter than 3 seconds. During a single instance of a video playing, we'll exclude any time spent replaying the video.
            "pageVideoViewsPaid": 6,          // The number of times your Page's promoted videos played for at least 3 seconds, or for nearly their total length if they're shorter than 3 seconds. For each impression of a video, we'll count video views separately and exclude any time spent replaying the video.
            "reactions": {                    // Total over past 180 days
                "like": 1,         // Like reactions - The "like" reaction counts include both "like" and "care" reactions.
                "love": 1,         // Love reactions
                "anger": 1,        // Anger reactions
                "haha": 1,         // Haha reactions
                "wow": 1,          // Wow reactions
                "sorry": 1,        // Sorry reactions
                "total": 6         // Total number of reactions
            },
            "username": "theGoodone",
            "verified": true,      // verified Facebook Page
            "website": "https://www.theGoodone.com"
        }
    }
}

اگر می خواهید در پست های فردی فیس بوک تجزیه و تحلیل کنید ، با پست پست /تجزیه و تحلیل تماس بگیرید. تجزیه و تحلیل سطح بازگشت پس از سطح شامل سهام ، لایک ، برداشت ، کلیک و موارد دیگر:

{
    "facebook": {
        "id": "1397547544885713_2159201585286968", // ID of the post at Facebook
        "postUrl": "https://www.facebook.com/1397547544885713_2159201585286968",
        "analytics": {
            "impressionsUnique": 3,    // People who had your Page's post enter their screen. Posts include statuses, photos, links, videos and more.
            "engagedUsers": 63,        // People who clicked anywhere in your posts.
            "clicksUnique": 2,         // Times people clicked on anywhere in your posts.
            "commentCount": 1,         // Count of comment for the post
            "impressionsUnique": 1,    // Count of unique impressions
            "likeCount": 0,            // Count of likes for the post
            "negativeFeedback": 1,     // Times people took a negative action in your post (e.g. hid it).
            "negativeFeedbackUnique": 1, // Unique times people took a negative action in your post (e.g. hid it).
            "reactions": {
                "like": 1,         // Like reactions - The "like" reaction counts include both "like" and "care" reactions.
                "love": 1,         // Love reactions
                "anger": 1,        // Anger reactions
                "haha": 1,         // Haha reactions
                "wow": 1,          // Wow reactions
                "sorry": 1,        // Sorry reactions
                "total": 6         // Total number of reactions
            },
            "videoViewTime": 0,        // Time, in milliseconds, your videos played, including videos played for less than 3 seconds and replays
            "videoViews": 0,           // Times your videos played for at least 3 seconds, or for nearly their total length if they're shorter than 3 seconds. During a single instance of a video playing, we'll exclude any time spent replaying the video. This includes live views.
            "videoViewsUnique": 0,     // Unique times your videos played for at least 3 seconds, or for nearly their total length if they're shorter than 3 seconds. During a single instance of a video playing, we'll exclude any time spent replaying the video. This includes live views.
        }
    }
}

به اشتراک گذاری در فیس بوک شروع کنید

اگر می خواهید در مورد نحوه اتصال حساب Facebook و ارسال متن ، تصاویر یا فیلم ها با استفاده از API اجتماعی ما اطلاعات بیشتری کسب کنید ، این راهنما را بررسی کنید. همچنین ، ما چندین بسته ادغام برای آسانتر کردن کارها داریم.

و البته ، اگر سوالی دارید به ما اطلاع دهید.


Source link

نوشته های مشابه

دیدگاهتان را بنویسید

دکمه بازگشت به بالا