§
    
?¸iÂ�  ã                   ó6  — d dl mZmZmZmZ d dlmZmZmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ  e¦   «         Z e
d
¬¦  «        Zg d¢g d¢ddddddddœddddddddœddddddddœd d!d"d#d$dd%dœd&d'ddd(dd)dœgd*d+dd,d-d.d/d0d1d2œd3d4d2œd5d6d2œd7d8d2œgd9d:œg d;¢g d<¢d=d>d?d@dAddBdœdCdDdddEddFdœdGdHddddIdJdœdKdLdddMddNdœdOdPdddQddRdœgddddddSdTdUdVd2œdWdXd2œdYdZd2œd[d\d2œgd]d:œg d^¢g d_¢d`dadbdcddddedœdfdgddddhdidœdjdkddddldmdœdndodddpddqdœdrdsdddtddudœgdvdwdxdydzd{d|d}d~d2œdd€d2œd�d‚d2œdƒd„d2œgd…d:œg d†¢g d‡¢dˆd‰dŠd‹dŒdd�dœdŽd�ddd�d‘d’dœd“d”ddd•dd–dœd—d˜ddd™ddšdœd›dœd�dždŸdd dœgd¡d¢d£d¤d¥d�d¦d§d¨d2œd©dªd2œd«d¬d2œd­d®d2œgd¯d:œg d°¢g d±¢d²d³d´dµd¶dd·dœd¸d¹dºd»d¼d½d¾dœd¿dÀdÁdÂddÃdÄdœdÅdÆdddÇddÈdœdÉdÊdËdÌdÍdÎdÏdœdÐdÑdËdÒdÓddÔdœgdÕdÖdd×dØdÙdÚdÛdÜd2œdÝdÞd2œdßdàd2œdádâd2œgdãd:œg dä¢g då¢dædçdÁdÂdèddédœdêdëddddìdídœdîdïdddðddñdœdòdódËdÒdôdõdödœd÷dødddùddúdœdûdüdýdþdÿd�d dœgdÕdÖd�d�d�d�d�d�dd2œ�d�dd2œ�d	�d
d2œ�d�dd2œg�dd:œ�dœZe                     �de�¬¦  «        �de�def�d„¦   «         Ze                     �d¦  «         e�d�¬¦  «         e�d�¬¦  «         e�d�¬¦  «         ee¦  «        f�de�de�de�de�de�def�d„¦   «         Ze                     �d¦  «         ee¦  «        f�de�de�def�d„¦   «         Z dS (  é    )Ú	APIRouterÚRequestÚFormÚDepends)ÚHTMLResponseÚRedirectResponseÚJSONResponse)ÚJinja2Templates)ÚSession)Úget_db)ÚUserPlatformKey)Úget_optional_user_id)Úencrypt_value)Ú	PLATFORMSÚ	templates)Ú	directory)zTelegram Accountz Telegram App (desktop or mobile)z-my.telegram.org access (for personal session))úOpen BotFather on TelegramzCreate a new bot with /newbotzCopy your Bot TokenzAdd bot to your group/channelzPaste token into our platformu8   Step 1 â€” Get Your API ID & API Hash (Personal Session)z÷Go to <a href='https://my.telegram.org' target='_blank'>my.telegram.org</a> and log in with your Telegram phone number. Navigate to <b>API Development Tools</b> and create a new application. Copy your <code>API ID</code> and <code>API Hash</code>.zhttps://my.telegram.orgzGo to my.telegram.orguV   This allows our platform to post to any group you are a member of â€” no bot required.NzMmy.telegram.org API Development Tools page showing API ID and API Hash fields)ÚtitleÚdescÚlinkÚ
link_labelÚtipÚwarnÚscreenshot_hintu8   Step 2 â€” Create a Bot using BotFather (Bot API Method)zòOpen Telegram and search for <b>@BotFather</b>. Send the command <code>/newbot</code>. Choose a name and a username ending in <code>bot</code>. BotFather will give you a <b>Bot Token</b> that looks like: <code>123456789:AABBCCddEEff...</code>zhttps://t.me/BotFatherr   zRKeep your Bot Token private. Anyone with this token can send messages as your bot.z?BotFather chat showing /newbot command and token being providedu-   Step 3 â€” Add Your Bot to a Group or Channelz°Open your Telegram group or channel settings. Tap <b>Add Members</b> and search for your bot by username. Add it. For channels, give the bot <b>Admin</b> rights so it can post.zbIf your bot cannot send messages, check that it has been added as an administrator to the channel.z;Telegram group settings showing bot added as a member/adminu   Step 4 â€” Find Your Chat IDa  Send a message in your group/channel then open this URL in your browser (replace TOKEN): <code>https://api.telegram.org/bot&lt;TOKEN&gt;/getUpdates</code>. Look for <code>chat.id</code> in the JSON response. Group IDs start with a <code>-</code> like <code>-100123456789</code>.zhttps://t.me/userinfobotz1Or message @userinfobot for your personal chat IDuj   For our platform's group posting feature, you don't need a chat ID â€” we fetch your groups automatically.zABrowser showing getUpdates JSON response with chat.id highlightedu0   Step 5 â€” Set API ID and Hash in Your .env FilezØOpen your platform's <code>.env</code> file and add:<br><code>TELEGRAM_API_ID=12345678</code><br><code>TELEGRAM_API_HASH=abcdef1234567890abcdef1234567890</code><br>Restart the platform for the changes to take effect.z_After setting these, restart the server and the Telethon session will initialize automatically.z>.env file with TELEGRAM_API_ID and TELEGRAM_API_HASH filled inu.   Bot Token (optional â€” for bot-based posting)z123456789:AABBccDDeeFFggHH...z.Chat ID (group/channel ID, e.g. -100123456789)z-100123456789z"https://core.telegram.org/bots/apizOfficial Telegram Bot API Docsu+   Unauthorized (401) â€” Bot token is invalidzzDouble-check that you copied the full Bot Token from BotFather. It should look like <code>123456789:AABBCCddEEff...</code>)ÚproblemÚsolutionu    Chat not found â€” Wrong Chat IDzuMake sure the bot has been added to the group/channel, and the chat ID is correct (groups start with <code>-</code>).u9   Telethon session not starting â€” Missing API credentialszzSet <code>TELEGRAM_API_ID</code> and <code>TELEGRAM_API_HASH</code> in your <code>.env</code> file and restart the server.u4   Message too long â€” Content exceeds 4096 charactersz[Telegram has a 4096 character limit per message. Split your content into multiple messages.z9Telegram BotFather create bot and get token tutorial 2024)ÚrequirementsÚquick_stepsÚdetailed_stepsÚapi_key_labelÚapi_key_placeholderÚsecret_key_labelÚextra_labelÚextra_placeholderÚdoc_urlÚ	doc_labelÚerrorsÚvideo_search)zLinkedIn AccountzLinkedIn Developer Appz!Share on LinkedIn Product enabled)úGo to LinkedIn Developer PortalzCreate a new ApplicationzAdd Share on LinkedIn productzClick Login with LinkedIn belowzToken saves automaticallyu.   Step 1 â€” Create a LinkedIn Developer AccountzôGo to <a href='https://developer.linkedin.com/' target='_blank'>developer.linkedin.com</a> and sign in with your LinkedIn account. Click <b>Create App</b>. Fill in the App Name (e.g., 'My Automation'), choose a LinkedIn Page, and upload a logo.zhttps://developer.linkedin.com/r)   un   You need a LinkedIn Page (company page) to create a developer app â€” create a free one if you don't have one.zCLinkedIn developer portal showing Create App button and form fieldsu$   Step 2 â€” Add the Required ProductszÞInside your app, go to the <b>Products</b> tab. Find and request access to: <b>Share on LinkedIn</b> and <b>Sign In with LinkedIn using OpenID Connect</b>. Click <b>Request Access</b> for each. Some are approved instantly.z\Make sure both products are approved (they show a green checkmark) before generating tokens.zHLinkedIn app Products tab showing Share on LinkedIn with approved statusu!   Step 3 â€” Set OAuth Redirect URLzÞGo to the <b>Auth</b> tab. Under <b>OAuth 2.0 Settings</b>, add the Redirect URL: <code>http://localhost:8000/linkedin/callback</code>. Save changes. Also note your <b>Client ID</b> and <b>Client Secret</b> from this page.zZThe redirect URL must exactly match what is set in your .env file (LINKEDIN_REDIRECT_URI).zELinkedIn app Auth tab showing redirect URL field and Client ID/Secretu)   Step 4 â€” Set Client ID & Secret in .envzãOpen your <code>.env</code> file and set:<br><code>LINKEDIN_CLIENT_ID=your_client_id</code><br><code>LINKEDIN_CLIENT_SECRET=your_client_secret</code><br><code>LINKEDIN_REDIRECT_URI=http://localhost:8000/linkedin/callback</code>z/After saving .env, restart the platform server.z7.env file with LinkedIn credentials filled in correctlyu1   Step 5 â€” Authorize Via OAuth (Click the Button)zÙOnce your .env is set, click the blue <b>Login with LinkedIn & Get Token</b> button. You'll be redirected to LinkedIn's login page. Approve access. You'll be redirected back and your token will be saved automatically.zITokens expire in 60 days. Simply click the Login button again to refresh.z4LinkedIn OAuth consent screen asking for permissionsz]https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedinz Official LinkedIn Share API Docsu*   REVOKED_ACCESS_TOKEN â€” Token has expiredzmLinkedIn tokens expire after 60 days. Click the <b>Login with LinkedIn</b> button again to get a fresh token.u%   403 Forbidden â€” Missing permissionszhMake sure you added the <b>Share on LinkedIn</b> product and it has been approved on your developer app.u.   invalid_redirect_uri â€” Redirect URL mismatchznYour <code>LINKEDIN_REDIRECT_URI</code> in .env must exactly match what is saved in the LinkedIn app Auth tab.u%   Member not found â€” Wrong Person URNzmOur platform fetches your Person URN automatically. If you see this error, re-authorize via the Login button.z;LinkedIn developer app OAuth 2.0 access token tutorial 2024)zTwitter / X Accountz Developer Account (Free tier OK)z!App with Read & Write permissions)úGo to Twitter Developer PortalzCreate a Project and Appz Enable OAuth 1.0a (Read & Write)z7Copy API Key, Secret, Access Token, Access Token SecretúPaste credentials belowu0   Step 1 â€” Apply for a Twitter Developer AccountzýGo to <a href='https://developer.twitter.com/en/portal/dashboard' target='_blank'>developer.twitter.com</a> and sign in. If prompted, describe your use case (e.g., 'Personal automation tool to schedule posts'). Free tier accounts are approved instantly.z1https://developer.twitter.com/en/portal/dashboardr*   zdYou do NOT need to pay for API access to post tweets from your own account. Free tier is sufficient.zBTwitter Developer Portal dashboard showing Projects & Apps sectionu#   Step 2 â€” Create a Project and AppzƒClick <b>+ New Project</b>. Give it a name and use case. Then create a new <b>App</b> inside the project. Choose a unique app name.zcMake sure to select your app environment as 'Production' not 'Development' for it to work reliably.z:Twitter app creation form with name and environment fieldsu.   Step 3 â€” Enable OAuth 1.0a with Read & WriteuÉ   Inside your app, go to <b>Settings â†’ User Authentication Settings</b>. Enable <b>OAuth 1.0a</b>. Set permissions to <b>Read and Write</b>. Set the callback URL to <code>http://localhost</code>. Save.zVIf you only enable Read permissions, posting tweets will return a 403 Forbidden error.zKTwitter app settings showing OAuth 1.0a enabled with Read Write permissionsu#   Step 4 â€” Copy API Keys and Tokensu÷   Go to <b>Keys and Tokens</b> tab. Copy:<br>â€¢ <b>API Key</b> (Consumer Key)<br>â€¢ <b>API Secret</b> (Consumer Secret)<br>Then click <b>Generate</b> under Access Token and Secret. Copy:<br>â€¢ <b>Access Token</b><br>â€¢ <b>Access Token Secret</b>uK   Save these keys immediately â€” the Access Token Secret is shown only once.z>Twitter Keys and Tokens tab showing all four credential fieldsu.   Step 5 â€” Paste Credentials into Our PlatformzÓIn the form on the right, paste your <b>API Key</b> and <b>API Secret</b>. In the Extra JSON field, paste:<br><code>{"access_token": "your_access_token", "access_token_secret": "your_access_token_secret"}</code>zHUse double quotes in the JSON. Single quotes will cause a parsing error.z@Our platform connect form with all Twitter credentials pasted inzAPI Key (Consumer Key)zaZbYcXdWeV...zAPI Secret (Consumer Secret)zAExtra JSON: {"access_token": "...", "access_token_secret": "..."}zA{"access_token": "12345-abc...", "access_token_secret": "xyz..."}z1https://developer.twitter.com/en/docs/twitter-apizOfficial Twitter / X API Docsu   89 â€” Invalid or expired tokenuz   Your Access Token is invalid. Go to the Twitter Developer Portal â†’ Keys and Tokens â†’ regenerate Access Token & Secret.u)   403 Forbidden â€” Write permission deniedu�   Your app only has Read permissions. Go to Settings â†’ User Authentication Settings and change to <b>Read and Write</b>. Then regenerate tokens.u   187 â€” Status is a duplicatezWTwitter does not allow posting the same tweet twice. Change your post content slightly.u*   Free plan rate limit â€” Too many requestszcThe free Twitter API plan allows limited posts per month. Upgrade to a paid plan for higher limits.zJTwitter X developer API OAuth 1.0a get API keys access token tutorial 2024)zReddit AccountzVerified Email on Redditz"Reddit Developer App (Script Type))zGo to reddit.com/prefs/appszCreate a new 'script' type appz Copy Client ID and Client Secretz-Add your Reddit username and password to JSONr+   u'   Step 1 â€” Go to Reddit App PreferenceszØLog in to Reddit and go to <a href='https://www.reddit.com/prefs/apps' target='_blank'>reddit.com/prefs/apps</a>. Scroll to the bottom and click <b>Create another app...</b> (or 'Create App' if it's your first time).z!https://www.reddit.com/prefs/appszGo to Reddit App PreferenceszEMake sure your Reddit account email is verified before creating apps.z>Reddit preferences apps page showing Create Another App buttonu#   Step 2 â€” Create a Script Type AppuÈ   Fill in the form:<br>â€¢ <b>Name</b>: Any name (e.g., 'MyAutomation')<br>â€¢ <b>App type</b>: Select <b>script</b><br>â€¢ <b>Redirect URI</b>: <code>http://localhost</code><br>Click <b>Create app</b>.uO   The 'script' type is for personal use automation â€” perfect for this platform.ub   Do NOT select 'web app' or 'installed app' â€” those require OAuth redirects and are more complex.z2Reddit create app form with 'script' type selectedu+   Step 3 â€” Copy Client ID and Client SecretzÇAfter creating the app, you'll see it listed. The <b>Client ID</b> is the short string shown directly below your app name (under 'personal use script'). The <b>Client Secret</b> is labelled 'secret'.z\The Client ID is usually 14-15 characters. The Client Secret is longer. Copy both carefully.zDReddit app listing showing Client ID below app name and Secret fieldu.   Step 4 â€” Prepare Your Extra JSON Credentialsao  In the Extra JSON field in our form, provide your Reddit login details and the target subreddit:<br><code>{</code><br>&nbsp;&nbsp;<code>"username": "your_reddit_username",</code><br>&nbsp;&nbsp;<code>"password": "your_reddit_password",</code><br>&nbsp;&nbsp;<code>"subreddit": "test",</code><br>&nbsp;&nbsp;<code>"title": "Default post title"</code><br><code>}</code>uf   The subreddit field should be without the r/ prefix â€” just the name such as 'test' or 'programming'.zFOur platform form with extra JSON field filled with Reddit credentialsu%   Step 5 â€” Create a User Agent StringzÍReddit's API requires a user agent. Our platform generates one for you automatically based on your app name. If you need a custom one, the format is: <code>platform:appname:v1.0 (by /u/yourusername)</code>zhttps://www.reddit.com/dev/api/zReddit API DocumentationzKA proper user agent helps Reddit identify your app and avoid rate limiting.z?Reddit API documentation showing user agent format requirementsz	Client IDÚAbc12Def34Ghi56zClient SecretzOExtra JSON: {"username":"...","password":"...","subreddit":"...","title":"..."}zU{"username": "myreddit", "password": "pass", "subreddit": "test", "title": "My Post"}zOfficial Reddit API Docsu(   Invalid credentials â€” 401 UnauthorizedzbYour Reddit username, password, Client ID, or Client Secret is incorrect. Double check each value.u6   SUBREDDIT_NOTALLOWED â€” Cannot post to that subredditz†Your account doesn't have permission to post in that subreddit (e.g., karma requirement or community restriction). Try 'r/test' first.u   RATELIMIT â€” Too many requestszOReddit rate limits new or low-karma accounts. Wait a few minutes and try again.u.   403 Forbidden â€” Account banned or restrictedzwYour Reddit account may be shadowbanned or the subreddit has restricted posting. Try posting manually first to confirm.zFReddit API script app Client ID Client Secret automation tutorial 2024)zInstagram Business Accountz&Facebook Page (connected to Instagram)zMeta Developer AppzInstagram Graph API enabled)z%Convert Instagram to Business Accountz"Connect Instagram to Facebook PagezCreate Meta Developer AppzEnable Instagram Graph APIz(Generate Page Access Token & paste belowu0   Step 1 â€” Convert to Instagram Business Accountuõ   Open Instagram app â†’ Go to your <b>Profile</b> â†’ Tap the <b>hamburger menu</b> (â‰¡) â†’ <b>Settings</b> â†’ <b>Account</b> â†’ <b>Switch to Professional Account</b> â†’ Select <b>Business</b>. Follow the steps to connect to a Facebook Page.z*https://help.instagram.com/502981923235522z*Instagram Help: Switch to Business Accountu_   Personal Instagram accounts cannot use the Graph API to post â€” Business account is mandatory.z@Instagram settings showing Switch to Professional Account optionu4   Step 2 â€” Connect Your Instagram to a Facebook PageuB  In Instagram settings go to <b>Account â†’ Linked Accounts â†’ Facebook</b>. Log in to your Facebook account and connect to your Facebook Page. If you don't have a Facebook Page, create one at <a href='https://www.facebook.com/pages/create' target='_blank'>facebook.com/pages/create</a> (it can be a simple business page).z%https://www.facebook.com/pages/createzCreate a Facebook PagezPA personal Facebook profile is NOT the same as a Facebook Page. You need a Page.zcIf Instagram and Facebook Page are not linked, the Graph API will not be able to find your account.z7Instagram account settings showing Facebook Page linkedu&   Step 3 â€” Create a Meta Developer Appuë   Go to <a href='https://developers.facebook.com/' target='_blank'>developers.facebook.com</a> and log in. Click <b>My Apps â†’ Create App</b>. Select app type <b>Business</b>. Fill in app name and contact email. Click <b>Create App</b>.z https://developers.facebook.com/zGo to Meta for Developersu`   Select Business type app â€” not Consumer or None. This gives access to the Instagram Graph API.zJMeta developer console showing Create App form with Business type selectedu*   Step 4 â€” Add Instagram Graph API Productu¾   Inside your app dashboard, under <b>Add a Product</b>, find <b>Instagram Graph API</b> and click <b>Set Up</b>. Then go to <b>Instagram Graph API â†’ Getting Started</b> in the left sidebar.zkYou can also add the 'Facebook Login' product which lets you generate access tokens via the Token Debugger.zAMeta app Products section showing Instagram Graph API being addedu'   Step 5 â€” Generate a Page Access Tokenaa  Go to the <a href='https://developers.facebook.com/tools/explorer/' target='_blank'>Graph API Explorer</a>. Select your app. Click <b>Generate Access Token</b> and grant required permissions: <code>instagram_basic</code>, <code>instagram_content_publish</code>, <code>pages_show_list</code>, <code>pages_read_engagement</code>. Copy the generated token.z/https://developers.facebook.com/tools/explorer/zGo to Graph API ExplorerzcFor a long-lived token (60 days), use the Access Token Debugger to exchange your short-lived token.zgShort-lived tokens expire in 1 hour. Generate a long-lived Page Access Token for uninterrupted posting.zPGraph API Explorer showing permission selection and Generate Access Token buttonu2   Step 6 â€” Find Your Instagram Business Account IDa  In the Graph API Explorer, with your access token selected, call: <code>/me/accounts</code>. This shows your Facebook Pages. Copy the Page <code>id</code>. Then call: <code>/{page-id}?fields=instagram_business_account</code> to get your Instagram Business Account ID.zGraph API ExplorerzyYour Instagram Business Account ID is different from your Instagram username. It is a long number like 17841400000000000.z_Graph API Explorer showing /me/accounts response with page ID and instagram_business_account idzPage Access Tokenz*EAABsbCS... (long token starting with EAA)zInstagram Business Account IDÚ17841400000000000z3https://developers.facebook.com/docs/instagram-api/z!Official Instagram Graph API Docsu:   (#100) Object does not exist â€” Wrong Business Account IDz—Your Instagram Business Account ID is incorrect. Use the Graph API Explorer to find it: call <code>/{page-id}?fields=instagram_business_account</code>.u*   Token expired â€” Access token has expiredz‚Short-lived tokens expire in 1 hour. Generate a <b>long-lived Page Access Token</b> (valid 60 days) using the Token Debugger tool.u;   App is in development mode â€” Cannot access other accountsuP   Go to your Meta app dashboard â†’ App Review â†’ Switch app to <b>Live mode</b>.u.   Media must be an image â€” Only images allowedz{Instagram Graph API requires every post to have an image URL. Make sure your post includes a publicly accessible image URL.zVInstagram Graph API Page Access Token Business Account ID tutorial Meta developer 2024)zFacebook Accountz$Facebook Page (not personal profile)zMeta Developer Accountzpages_manage_posts permission)zCreate Meta Developer AccountzCreate new App (Business type)zAdd Pages API productz+Generate Page Access Token with permissionsz(Copy Page ID and paste credentials belowu*   Step 1 â€” Create a Meta Developer AccountzþGo to <a href='https://developers.facebook.com/' target='_blank'>developers.facebook.com</a> and log in with your Facebook account. If you haven't registered as a developer, you'll be prompted to verify your phone number and agree to the developer terms.zLUse the same Facebook account that administers the Page you want to post to.z1Meta developer portal login and registration pageu   Step 2 â€” Create a New AppuŒ   Click <b>My Apps â†’ Create App</b>. Select <b>Business</b> as the app type. Enter your App Name and contact email. Click <b>Create App</b>.uN   Select the Business type â€” other types may not have access to the Pages API.zCMeta App creation form with Business type selected and name enteredu$   Step 3 â€” Add the Pages API ProductzÆIn your app dashboard, scroll down to <b>Add a Product</b>. Find <b>Facebook Login</b> and also <b>Pages API</b>. Click <b>Set Up</b> for Pages API. This allows your app to manage and post to pages.ub   Adding Facebook Login is also helpful â€” it enables the Token Debugger for easy token generation.z>Meta app dashboard Products section with Pages API being addedu'   Step 4 â€” Generate a Page Access Tokenu}  Go to the <a href='https://developers.facebook.com/tools/explorer/' target='_blank'>Graph API Explorer</a>. Select your app. Click <b>Generate Access Token</b>. Grant these permissions:<br>â€¢ <code>pages_manage_posts</code><br>â€¢ <code>pages_read_engagement</code><br>â€¢ <code>pages_show_list</code><br>Select your Facebook Page when prompted. Copy the <b>Page Access Token</b>.z`Use the Access Token Debugger to exchange your short-lived token for a long-lived one (60 days).u`   Never use your personal User Access Token to post to pages â€” always use the Page Access Token.zMGraph API Explorer showing Permission selector with pages_manage_posts tickedu%   Step 5 â€” Find Your Facebook Page IDzÞOption 1: Go to your Facebook Page, click <b>About</b> in the left sidebar. Scroll down to see the <b>Page ID</b> number.<br>Option 2: In Graph API Explorer, call <code>/me/accounts</code> to list your pages and their IDs.z^Your Page ID is a long number like 123456789012345. It is different from your page's username.z9Facebook Page About section showing Page ID at the bottomu0   Step 6 â€” Submit for App Review (for Live Apps)uø   If you want other users to use your app (not just yourself), go to <b>App Review â†’ Permissions and Features</b>. Request access to <code>pages_manage_posts</code> and <code>pages_read_engagement</code>. Provide a screen recording of the use case.z/https://developers.facebook.com/docs/app-reviewzMeta App Review DocumentationzFor personal use only (just your own page), you don't need App Review approval. Only submit if you're building for other users.z4Meta App Review page showing permission request formzFacebook Page IDÚ123456789012345z.https://developers.facebook.com/docs/pages-apiz Official Facebook Pages API Docsu4   OAuthException (190) â€” Token is invalid or expiredzŽYour Page Access Token has expired. Go to the Graph API Explorer and generate a fresh token. Use the Token Debugger to get a long-lived token.z7(#200) Requires extended permission: pages_manage_postsz}When generating the access token, make sure to tick the <code>pages_manage_posts</code> permission in the Graph API Explorer.u6   App in Development Mode â€” Only developers can use itug   Switch your app to <b>Live mode</b> in the Meta Dashboard â†’ App Settings â†’ Basic â†’ Status toggle.u    Page not found â€” Wrong Page IDzuCheck your Page ID on your Facebook Page's About section or call <code>/me/accounts</code> in the Graph API Explorer.zTFacebook Pages API Page Access Token Graph API Explorer tutorial Meta developer 2024)ÚtelegramÚlinkedinÚtwitterÚredditÚ	instagramÚfacebookz/connect/{platform})Úresponse_classÚplatformÚrequestc                 ó
  — t          |¦  «        }|st          dd¬¦  «        S t          j        | ¦  «        }|st          dd¬¦  «        S t                               | i ¦  «        }t
                               d||||dœ¦  «        S )Nz/logini.  ©Ústatus_codez
/dashboardzconnect_platform.html)r7   r6   ÚinstructionsÚuser_id)r   r   r   ÚgetÚPLATFORM_INSTRUCTIONSr   ÚTemplateResponse)r6   r7   r<   Úpinfor;   s        úmC:\Users\ELCOT\Desktop\my one click automation soical media\automation_platform\app\routers\connect_router.pyÚconnect_pagerB   =  sœ   € å" 7Ñ+Ô+€GØð ;Ý °cÐ:Ñ:Ô:Ð:åŒM˜(Ñ#Ô#€EØð ?Ý ¸#Ð>Ñ>Ô>Ð>å(×,Ò,¨X°rÑ:Ô:€LÝ×%Ò%Ð&=ØØØ$Øð	@ð @ñ ô ð ó    z/api/connect/{platform}Ú )ÚdefaultÚapi_keyÚ
secret_keyÚextraÚdbc              ƒ   óª  K  — t          |¦  «        }|st          dddœd¬¦  «        S | t          vrt          dddœd¬¦  «        S |                     t          ¦  «                             t          j        |k    t          j        | k    ¦  «                             ¦   «         }|rt          |¦  «        nd}|rt          |¦  «        nd}	|rt          |¦  «        nd}
|r||_
        |	|_        |
|_        n)t	          || ||	|
¬	¦  «        }|                     |¦  «         |                     ¦   «          t          d
t          |          d         › d�dœ¦  «        S )NFúNot authenticated©ÚsuccessÚmessageé‘  r9   zUnknown platformi�  rD   )r<   Úplatform_nameÚencrypted_api_keyÚencrypted_secret_keyÚencrypted_extraTÚdisplay_namez connected successfully!)r   r	   r   Úqueryr   Úfilterr<   rP   Úfirstr   rQ   rR   rS   ÚaddÚcommit)r6   r7   rF   rG   rH   rI   r<   ÚexistingÚencrypted_apiÚencrypted_secretrS   Únew_keys               rA   Úapi_connect_platformr^   P  s  è è € õ # 7Ñ+Ô+€GØð aÝ¨Ð:MÐNÐNÐ\_Ð`Ñ`Ô`Ð`à•yÐ Ð Ý¨Ð:LÐMÐMÐ[^Ð_Ñ_Ô_Ð_ð �xŠx�Ñ(Ô(×/Ò/ÝÔ 7Ò*ÝÔ%¨Ò1ñô ÷ ‚e�g„gð ð
 /6Ð=•M 'Ñ*Ô*Ð*¸2€MØ4>ÐF•} ZÑ0Ô0Ð0ÀBÐØ.3Ð;•m EÑ*Ô*Ð*¸€Oàð Ø%2ˆÔ"Ø(8ˆÔ%Ø#2ˆÔ Ð å!ØØ"Ø+Ø!1Ø+ð
ñ 
ô 
ˆð 	�Šˆw‰Œˆà‡I‚I�K„K€KÝ D½	À(Ô8KÈNÔ8[Ð5uÐ5uÐ5uÐvÐvÑwÔwÐwrC   z/api/disconnect/{platform}c              ƒ   óZ  K  — t          |¦  «        }|st          dddœd¬¦  «        S |                     t          ¦  «                             t          j        |k    t          j        | k    ¦  «                             ¦   «          |                     ¦   «          t          dd| › �dœ¦  «        S )NFrK   rL   rO   r9   TzDisconnected from )	r   r	   rU   r   rV   r<   rP   ÚdeleterY   )r6   r7   rI   r<   s       rA   Úapi_disconnect_platformra   |  s©   è è € õ # 7Ñ+Ô+€GØð aÝ¨Ð:MÐNÐNÐ\_Ð`Ñ`Ô`Ð`à‡H‚H�_ÑÔ×$Ò$ÝÔ 7Ò*ÝÔ%¨Ò1ñô ÷ ‚f�h„h€hØ‡I‚I�K„K€Kå DÐ5TÈ(Ð5TÐ5TÐUÐUÑVÔVÐVrC   )!Úfastapir   r   r   r   Úfastapi.responsesr   r   r	   Úfastapi.templatingr
   Úsqlalchemy.ormr   Úapp.databaser   Úapp.models.api_keysr   Úapp.auth.jwt_handlerr   Ú
app.cryptor   Ú
app.configr   Úrouterr   r>   r=   ÚstrrB   Úpostr^   r`   ra   © rC   rA   ú<module>ro      s  ðØ 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JØ .Ð .Ð .Ð .Ð .Ð .Ø "Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ð Ð Ø /Ð /Ð /Ð /Ð /Ð /Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø $Ð $Ð $Ð $Ð $Ð $Ø  Ð  Ð  Ð  Ð  Ð  à	ˆ‰Œ€ØˆO kÐ2Ñ2Ô2€	ð
ð 
ð 
ð

ð 
ð 
ð Tð RØ1Ø5ØoØØ#rðð ð Tð MØ0Ø:ØØlØ#dðð ð Ið KØØ"Ø{ØØ#`ðð ð 8ð qØ2ØQð DØØ#fðð ð Lð sØØ"ØxØØ#cðð ðK.
ð^ JØ>Ø ØGØ,Ø7Ø5ð Ið Yðð ð
 >ð Tðð ð
 Wð Yðð ð
 RØyðð ð
ð$ TðkVð Vðt
ð 
ð 
ð

ð 
ð 
ð Jð OØ9Ø?ð HØØ#hðð ð @ð yØØ"ØuØØ#mðð ð =ð yØØ"ØØtØ#jðð ð Eð ~ØØ"ØHØØ#\ðð ð Mð tØØ"ØbØØ#Yðð ðK.
ð^ Ø#Ø ØØ!ØrØ7ð Hð Lðð ð
 Cð Gðð ð
 Lð Mðð ð
 Cð Lðð ð
ð$ VðkVð Vðt
ð 
ð 
ð

ð 
ð 
ð Lð XØKØ>Ø}ØØ#gðð ð ?ð ^ØØ"ØØ}Ø#_ðð ð Jð dØØ"ØØpØ#pðð ð ?ð RØØ"ØdØØ#cðð ð Jð vØØ"ØaØØ#eðð ðK.
ð^ 2Ø.Ø:ØZØ`ØFØ4ð =ð Yðð ð
 Gð oðð ð
 ;Øuðð ð
 Hð Bðð ð
ð$ eðkVð Vðt
ð 
ð 
ð

ð 
ð 
ð Cð sØ;Ø<Ø^ØØ#cðð ð ?ð cØØ"ØhØ|Ø#Wðð ð Gð bØØ"ØuØØ#iðð ð Jð ZØØ"ØØØ#kðð ð Að hØ9Ø8ØdØØ#dðð ðK.
ð^ %Ø0Ø+ØhØtØ4Ø/ð Fð Aðð ð
 Tð eðð ð
 =Ømðð ð
 Lð Vðð ð
ð$ aðkVð Vðt
ð 
ð 
ð
ð 
ð 
ð Lð PØDØJØxØØ#eðð ð Pð ]Ø?Ø6ØiØ}Ø#\ðð ð Bð FØ:Ø9ØØzØ#oðð ð Fð YØØ"ð EØØ#fðð ð Cð |ØIØ8Ø|ð BØ#uðð ð Nð fØIØ2ð SØð $Eðð ð]7
ðp -ØKØ Ø6Ø0ØHØ8ð Xð vðð ð
 Hð aðð ð
 YØnðð ð
 Lð Zðð ð
ð$ qð`ð `ðH
ð 
ð 
ð
ð 
ð 
ð Fð YØ:Ø9ØeØØ#Vðð ð 7ð gØØ"ØØhØ#hðð ð @ð aØØ"Ø{ØØ#cðð ð Cð XØIØ2ØyØzØ#rðð ð Að yØØ"ØwØØ#^ðð ð Lð SØIØ=ð YØÙ#Yðð ð]7
ðp -ØKØ Ù)Ù.ÙCÙ7ñ Rñ mðð ñ
 Uñ \ðð ñ
 Tñ Fðð ñ
 >ñ Tðð ð
ñ$ oð`ð `ñUkð kÐ ð\ ‡‚Ñ!°,�Ñ?Ô?ñ˜3ñ ¨ð ñ ð ñ @Ô?ðð$ ‡‚Ñ&Ñ'Ô'ð �4¡Ñ#Ñ#Ô#Ø�d¡2Ñ&Ñ&Ô&Ø�™bÑ!Ñ!Ô!Ø�'˜&‘/”/ð(xñ (xØñ(xàñ(xð ñ(xð ñ	(xð
 ñ(xð 	ð(xñ (xð (xñ (Ô'ð(xðV ‡‚Ñ+Ñ,Ô,ð �'˜&‘/”/ðWñ WØñWàñWð 	ðWñ Wð Wñ -Ô,ðWð Wð WrC   