---
title: Platform apps
description: "Register Peal's app on each platform a self-hosted server offers, with the addresses it prints for them."
sidebar:
  icon: layout-grid
---

Your server offers a platform once you've registered an app for it on that platform and given the server the app's credentials. Start with the token keys and the addresses below, then follow the section for each platform you want.

## Register the apps [#channels]

Each platform takes its own settings, and several need the platform's approval before you serve other people:

| Platform                                    | Settings                                                                                                             | Before serving other people                     |
| ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| [Bluesky](#bluesky)                         | `BLUESKY_CLIENT_KEYS`                                                                                                | Nothing to register                             |
| [LinkedIn](#linkedin)                       | `LINKEDIN_CLIENT_ID`, `LINKEDIN_CLIENT_SECRET`                                                                       | Nothing: both products are granted at once      |
| [LinkedIn company pages](#linkedin-pages)   | `LINKEDIN_PAGES_CLIENT_ID`, `LINKEDIN_PAGES_CLIENT_SECRET`                                                           | LinkedIn's review, then its Standard tier       |
| [X](#x)                                     | `X_CLIENT_ID`, `X_CLIENT_SECRET`                                                                                     | Credits bought ahead                            |
| [TikTok](#tiktok)                           | `TIKTOK_CLIENT_KEY`, `TIKTOK_CLIENT_SECRET`                                                                          | TikTok's audit                                  |
| [Threads, Instagram, Facebook Pages](#meta) | `META_APP_ID`, `META_APP_SECRET`, `INSTAGRAM_APP_ID`, `INSTAGRAM_APP_SECRET`, `THREADS_APP_ID`, `THREADS_APP_SECRET` | Meta's App Review and Business Verification     |
| [YouTube](#youtube)                         | `YOUTUBE_CLIENT_ID`, `YOUTUBE_CLIENT_SECRET`                                                                         | A published consent screen, verified by Google  |
| [Pinterest](#pinterest)                     | `PINTEREST_APP_ID`, `PINTEREST_APP_SECRET`                                                                           | Pinterest's Standard access                     |
| [Google Business Profile](#google-business) | `GOOGLE_BUSINESS_CLIENT_ID`, `GOOGLE_BUSINESS_CLIENT_SECRET`                                                         | Google's access to the Business Profile APIs    |
| [Slack](#slack)                             | `SLACK_CLIENT_ID`, `SLACK_CLIENT_SECRET`                                                                             | Public distribution, which you turn on at Slack |
| [Snapchat](#snapchat)                       | `SNAPCHAT_CLIENT_ID`, `SNAPCHAT_CLIENT_SECRET`                                                                       | Snap's allowlisting of the app                  |
| [WordPress websites](#wordpress)            | None: each member gives their site's application password                                                            | Nothing to register                             |
| [WordPress.com](#wordpress-com)             | `WORDPRESS_COM_CLIENT_ID`, `WORDPRESS_COM_CLIENT_SECRET`                                                             | Nothing known to review                         |
| [DEV and Hashnode](#devto-hashnode)         | None: each member gives a key of their own                                                                           | Nothing to register                             |

For LinkedIn, X, YouTube, Pinterest, Google Business Profile, Slack, Snapchat and WordPress.com, setting one of the two settings without the other stops the server at startup. Without both, **Channels** doesn't offer the platform. [Environment variables](/self-hosting/environment-variables#channels) lists every platform setting, with its default.

### Token keys [#token-keys]

The server encrypts the tokens of connected accounts, and the signing secrets of [webhooks](/developers/webhooks#self-hosting), with the keys in `PEAL_TOKEN_KEYS`. Without it, the server starts, but connecting an account or adding a webhook endpoint fails. To create a key, run:

```sh
echo "k1:$(openssl rand -base64 32)"
```

The value lists `keyId:key` entries separated by commas, such as `k2:<key>,k1:<key>`. The first key encrypts, and every listed key decrypts. To rotate, put a new key first and keep the old ones. A malformed value stops the server at startup.

> **Keep a copy of the keys**
>
> Keep the keys secret, and keep a copy. Without them, every channel has to be
> reconnected.

### Network and memory [#network]

The server reaches the platforms itself, over HTTPS, so it needs internet access to connect accounts and to publish. It only calls servers at public addresses, on the default HTTPS port, so nobody can point it at your private network.

To publish an image or a video, the server reads the whole file from the media store into memory, then uploads it, unless the platform takes videos in parts. Give the server enough memory for the largest files your members post.

For each platform, the server calls these hosts and sends media this way:

| Platform                | The server calls                                                                                                                                      | Media                                                                                                                                                                  |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Mastodon                | Each account's Mastodon server                                                                                                                        | Images and videos read whole                                                                                                                                           |
| Bluesky                 | The Bluesky server that holds each account, and Bluesky's video service, `https://video.bsky.app`, for videos                                         | Images and videos read whole: a Bluesky video can take up to 300 MB                                                                                                    |
| LinkedIn                | `www.linkedin.com`, `api.linkedin.com` and the upload addresses LinkedIn gives                                                                        | Videos in parts of 4 MiB, one held at a time                                                                                                                           |
| X                       | `api.x.com`                                                                                                                                           | Videos in parts of 4 MiB, one held at a time                                                                                                                           |
| TikTok                  | `open.tiktokapis.com` and the upload addresses TikTok gives                                                                                           | Videos in parts of 10 MB, one held at a time, unless TikTok fetches them ([TikTok](#tiktok))                                                                           |
| Meta                    | `graph.facebook.com`, `graph.instagram.com`, `api.instagram.com` and `graph.threads.com`                                                              | Images and videos fetched by Meta from the media store                                                                                                                 |
| YouTube                 | `oauth2.googleapis.com` and `www.googleapis.com`                                                                                                      | Videos in parts of 8 MiB, one held at a time                                                                                                                           |
| Pinterest               | `api.pinterest.com` (or the Sandbox), and the address Pinterest names for each video, an object store's                                               | Videos sent as they're read, never held whole; images fetched by Pinterest                                                                                             |
| Google Business Profile | `oauth2.googleapis.com`, `mybusinessaccountmanagement.googleapis.com`, `mybusinessbusinessinformation.googleapis.com` and `mybusiness.googleapis.com` | Photos fetched by Google from the media store                                                                                                                          |
| Google Ads              | `oauth2.googleapis.com` and `googleads.googleapis.com`, when `PEAL_ADS_NETWORKS` names `google`                                                       | None, because it only reads                                                                                                                                            |
| Slack                   | `slack.com`, and `files.slack.com`, where Slack has each image uploaded                                                                               | Images sent as they're read, never held whole                                                                                                                          |
| Snapchat                | `accounts.snapchat.com` and `businessapi.snapchat.com`                                                                                                | Videos encrypted and sent in parts of 32 MiB, as Snap's sample splits them; one part and its encrypted copy held at a time, so a video of 32 MiB or less is held whole |
| WordPress.com           | `public-api.wordpress.com`, whose API serves each site's core routes                                                                                  | Images read whole                                                                                                                                                      |
| DEV                     | `dev.to`                                                                                                                                              | Images read whole                                                                                                                                                      |
| Hashnode                | `gql-beta.hashnode.com`, and the upload address Hashnode gives for each image                                                                         | Images sent as they're read                                                                                                                                            |

The platforms send people back to `PUBLIC_URL/connect/<platform>/callback`, through their browser. They never call the server themselves, apart from Bluesky reading Peal's client description, and Meta's data deletion requests and events.

### Addresses to register [#platform-addresses]

Each platform's app gets addresses on your server. One is where the platform sends people back after they sign in. For Meta, others are where its servers call yours.

One command prints them all for your `PUBLIC_URL`, each next to the setting it goes in, from the paths the server itself answers and sends. Run it from the repository, or on a running server, which answers for its own `PUBLIC_URL`, with the stack's files and settings as in [With Docker Compose and Caddy](/self-hosting#compose):

```sh From the repository
PUBLIC_URL=https://peal.example.com bun nx run peal-server:platform-addresses
```

```sh On a running server
docker compose --project-name peal --file compose.production.yaml \
  --file compose.self-host.yaml --env-file /srv/peal/peal.env \
  exec server bun packages/peal-server/scripts/platform-addresses.ts
```

With `--json`, it prints the same list for a program to read. Run it again after you change `PUBLIC_URL`, and after an upgrade that adds a platform.

> **Copy the addresses exactly**
>
> Register what the command prints, copied, never addresses typed by hand. A
> platform refuses a sign-in whose redirect address differs from the registered
> one by a single character, a trailing slash included.

The command marks the addresses that the platform's servers call: Meta's two callbacks and its webhooks, and Bluesky's client documents. These must answer the internet with no sign-in in front of them, so let them through any login page or allow list you put before the server. People's browsers open the others.

## Bluesky [#bluesky]

A production server connects Bluesky accounts only with keys of its own, which identify it to Bluesky. You don't register anything with Bluesky. Its servers read Peal's client description, and the public keys beside it, at the addresses [the command](#platform-addresses) prints for Bluesky.

1. **Check the address**

    `PUBLIC_URL` must be HTTPS, without a port.

2. **Create a key**

    From the repository, run:

    ```sh
    bun nx run peal-server:bluesky-key
    ```

3. **Set the key**

    Put the line it prints in `BLUESKY_CLIENT_KEYS`.

Entries are separated by commas. To rotate, put a new key first, and keep the old ones until the sessions they signed for have been refreshed.

Without keys, a server running from source on `localhost` uses Bluesky's development client, whose sessions last two weeks. Any other server can't connect Bluesky.

## LinkedIn [#linkedin]

To connect LinkedIn members, register an app on LinkedIn's developer portal. LinkedIn asks for a LinkedIn page to own it.

1. **Add the products**

    Add the **Sign In with LinkedIn using OpenID Connect** and **Share on LinkedIn** products. LinkedIn grants both at once, without review.

2. **Add the redirect URL**

    Under **Auth**, add the address [the command](#platform-addresses) prints for LinkedIn as an authorized redirect URL.

3. **Set the credentials**

    Put the app's client id in `LINKEDIN_CLIENT_ID` and its primary client secret in `LINKEDIN_CLIENT_SECRET`.

These apps get no refresh token. Members reconnect their channel every 60 days, and Peal tells them a week before.

> **Keep LinkedIn's API version current**
>
> Peal calls LinkedIn's API in the version `LINKEDIN_API_VERSION` names, a
> recent one unless you set it. LinkedIn retires each version a year after its
> release, and every post fails on a retired one.

## LinkedIn company pages [#linkedin-pages]

Posting to company pages takes LinkedIn's **Community Management API**. LinkedIn reviews it, and grants it only to an app that has no other product, so you can't add it to the app above. A server that has only the first app keeps connecting profiles, as before.

1. **Create a second app**

    Create it on LinkedIn's developer portal, for the same LinkedIn page, with no product on it. LinkedIn asks a super admin of that page to verify the app.

2. **Request the Community Management API**

    LinkedIn grants it to registered legal organizations, for commercial uses. It checks a business email address, the organization and its website, and a personal email address doesn't pass. Its terms keep what the API serves for your own organization's clients, so read them with your use of the server in mind.

3. **Move to the Standard tier**

    LinkedIn first grants the **Development tier**, for building. It allows 500 calls a day for the app and 100 for each member, and no batch read, which Peal doesn't use. Ask for the **Standard tier** before real use. LinkedIn then asks for your privacy policy, and a screen recording of each use: here, connecting a page, posting to it and reading its posts' statistics.

4. **Add the redirect URL**

    Under **Auth**, add the same redirect URL, `PUBLIC_URL/connect/linkedin/callback`.

5. **Set the credentials**

    Put the app's client id in `LINKEDIN_PAGES_CLIENT_ID` and its primary client secret in `LINKEDIN_PAGES_CLIENT_SECRET`.

Peal asks members for `w_organization_social`, `r_organization_social` and `rw_organization_admin`, and lists the pages each one administers. It posts to the pages they choose with their own access, which lasts 60 days.

LinkedIn gives refresh tokens to approved partners only. When your app gets them, Peal renews a page's access by itself for a year after the sign-in. Otherwise the page is reconnected every 60 days, like a profile.

Pages are the only LinkedIn channels whose posts Peal reads counts on, and finds again after a lost answer.

**Comments in the inbox**

To read and answer pages' comments in the [inbox](/guides/engage/inbox#linkedin), add `linkedin` to `PEAL_INBOX_PLATFORMS`. Do it once the app's **Products** tab lists `r_organization_social_feed` and `w_organization_social_feed` among the Community Management API's scopes. The pages' sign-in then asks for them, and LinkedIn refuses the whole sign-in to an app that doesn't hold them.

On the Development tier, LinkedIn allows the app 500 calls a day and each member 100, posting included. Comment reads take at most 200 of the app's calls and 40 of each member's (`LINKEDIN_DAILY_COMMENT_CALLS`, `LINKEDIN_DAILY_COMMENT_CALLS_PER_MEMBER`), then stop for the day so posting keeps the rest. The member is whoever connected the page. Raise both on the Standard tier.

The Standard tier's review asks you to show how the app displays a member's comment on a page's post, and which of the commenter's profile fields it shows. Peal shows the comment's text and when it was written, and no profile field (the commenter is "A LinkedIn member"). Record that with the setting on.

## X [#x]

To connect X accounts, register an app in X's developer console.

1. **Turn on OAuth 2.0**

    Under the app's user authentication settings, turn on OAuth 2.0, as a **Web App, Automated App or Bot**, with **Read and write** permissions.

2. **Add the callback URI**

    Add the address [the command](#platform-addresses) prints for X as a callback URI, exactly. X refuses `localhost`, so in development use `http://127.0.0.1` and its port.

3. **Set the credentials**

    Put the OAuth 2.0 client id in `X_CLIENT_ID` and its client secret in `X_CLIENT_SECRET`.

> **X bills the app for every request**
>
> X bills each API request to the app, from credits bought ahead
> ([pricing](https://docs.x.com/x-api/getting-started/pricing)), and a post with
> a link costs about 13 times as much as one without. Buy credits and set a
> spending limit in X's console.

Once the credits run out (X answers `402`) or the limit is reached (`usage-capped`), X refuses every post from the app until you add credits or raise the limit. The posts aren't at fault, so Peal keeps them waiting and tries each one again every half hour. They go out once you've paid. A post still refused a day after its time fails with the reason "the platform refused this server's app until its operator pays for it".

Peal logs an error at the first refusal, then once an hour while it lasts, however many posts are waiting (`event.name` `peal.app_refused`). The alert "A platform refuses the server's app until it is paid for" reports it. Peal also counts every refused attempt in the metric `peal.publishing.app_refusals`.

Peal counts each workspace's posts on X, and how many held a link, by calendar month (UTC), in `billing.metered_posts`, so you can see who spends what. Plans don't limit them yet. The counts go with the workspace's export and its deletion.

X's access lasts two hours. Peal renews it when it posts, and renews the access of an account that hasn't posted for 30 days, so X keeps the account connected without a rotation every two hours.

## TikTok [#tiktok]

To connect TikTok creators, register an app on TikTok for Developers.

1. **Add Login Kit**

    Add the **Login Kit** product, with the address [the command](#platform-addresses) prints for TikTok as its redirect URI for the web. TikTok takes HTTPS redirect URIs only, so in development use an HTTPS tunnel.

2. **Add the posting and display APIs**

    Add the **Content Posting API**, with **Direct Post** on, and the **Display API**, for analytics. Add the scopes `user.info.basic`, `user.info.profile`, `video.publish` and `video.list`.

3. **Set the credentials**

    Put the app's client key in `TIKTOK_CLIENT_KEY` and its client secret in `TIKTOK_CLIENT_SECRET`.

Until TikTok audits the app, it takes up to five creators a day, whose accounts must be private, and only posts they alone can see. Other posts fail with the reason "the platform takes only private posts from this server's app". Once you've tried the app, ask for the audit from its page.

Before scheduling, Peal shows the creator's nickname, the audiences their account offers, the interactions they allow and TikTok's consent, as TikTok's guidelines ask.

TikTok fetches photos only from a URL prefix or a domain you verified for the app, under **URL properties**. Serve the media store at a public address (`PEAL_MEDIA_PUBLIC_BASE_URL`), verify it, and set `TIKTOK_MEDIA_URL_PREFIX` to it. TikTok then fetches videos too, as its guidelines prefer for media already on a server. Without it, Peal sends videos in parts of 10 MB, holding one part at a time, and refuses TikTok posts with photos when they're scheduled.

## Threads, Instagram and Facebook Pages [#meta]

One app in Meta's developer dashboard connects all three, through three use cases, each with its own credentials:

| Use case                                                                                                         | Connects                                                    | Permissions                                                                                                                                                                                                                                                                                                                                                                                             | Settings, from                                                                                                                                          |
| ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Facebook Login**                                                                                               | Facebook Pages, and Instagram through a Page                | `pages_show_list`, `pages_read_engagement` and `pages_manage_posts` for Facebook Pages; `instagram_basic`, `instagram_content_publish` and `instagram_manage_insights` for Instagram (insights only for analytics, and a member may decline them); `business_management` for both, which lists the Pages a business portfolio owns (a member may decline it, and then connects only Pages of their own) | `META_APP_ID` and `META_APP_SECRET`, from the app's basic settings                                                                                      |
| **Instagram** ("Manage messaging and content on Instagram", the Instagram API with Instagram Login)              | Instagram professional accounts                             | `instagram_business_basic`, `instagram_business_content_publish` and `instagram_business_manage_insights`                                                                                                                                                                                                                                                                                               | `INSTAGRAM_APP_ID` and `INSTAGRAM_APP_SECRET`, from its **Business login settings**, which show an Instagram app id and secret apart from the main ones |
| **Instagram**, its API setup with Unified login (a configuration of Facebook Login for Business on the main app) | Instagram professional accounts a business portfolio shares | The configuration's: `instagram_basic`, `instagram_content_publish`, `instagram_manage_insights` and `instagram_manage_comments`, plus `instagram_manage_messages`, which Meta always adds                                                                                                                                                                                                              | `META_INSTAGRAM_CONFIG_ID`, the configuration's id, with `META_APP_ID` and `META_APP_SECRET`                                                            |
| **Threads**                                                                                                      | Threads accounts                                            | `threads_basic` and `threads_content_publish`                                                                                                                                                                                                                                                                                                                                                           | `THREADS_APP_ID` and `THREADS_APP_SECRET`, from its Threads settings                                                                                    |

A platform whose settings are missing isn't offered. Instagram is offered with the settings of any of its three ways in. Members see the ways your server has in this order, the first one as the main button:

| Way in                                        | Needs                                                   | Access                                                                                                               | Gives                                                                                                                                                                      |
| --------------------------------------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Unified login (`META_INSTAGRAM_CONFIG_ID`)    | A professional account in a business portfolio, no Page | The business portfolio's system user token, which never expires when the configuration says so; Peal never renews it | Publishing (images, reels, carousels), insights once the configuration holds `instagram_manage_insights`, and comments, but no direct messages; calls `graph.facebook.com` |
| Instagram Login (`INSTAGRAM_APP_ID`)          | A professional account, no Page                         | 60 days, renewed by Peal a week ahead                                                                                | Publishing (images, reels, carousels) and insights; calls `graph.instagram.com`                                                                                            |
| Facebook Login through a Page (`META_APP_ID`) | A professional account linked to a Page                 | The Page's, which doesn't expire                                                                                     | The same, plus what only that API has (product tags, collaborators, hashtag search), which Peal doesn't use yet; calls `graph.facebook.com`                                |

In the dashboard, give each use case the addresses [the command](#platform-addresses) prints for it:

| Use case       | Settings the addresses go in                                                                                                                   |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| Facebook Login | Its valid OAuth redirect URIs, two of them, for Facebook Pages and for Instagram; its data deletion request URL; its deauthorize callback URL  |
| Instagram      | Its business login's OAuth redirect URIs; its data deletion request URL; its deauthorize callback URL                                          |
| Unified login  | The configuration's redirect URL, Facebook Login's Instagram address; its data deletion, deauthorize and events addresses are Facebook Login's |
| Threads        | Its redirect callback URL; its data deletion request URL; its deauthorize callback URL                                                         |

### Set up Unified login [#unified-login]

Unified login is Meta's business sign-in for Instagram. A member signs in with Instagram or Facebook, picks a business portfolio, then its Instagram accounts, and needs no Facebook Page. It runs on the main app, so set it up once Facebook Login works.

1. **Create the configuration**

    In the app's dashboard, go to **Use cases** > **Manage messaging & content on Instagram** > **Customize** > **API setup with Unified login**, and click **Create new configuration**.

2. **Choose what it asks**

    Ask for Instagram accounts, with a system user token that never expires. Keep `instagram_basic`, `instagram_content_publish` and `instagram_manage_comments`, and add `instagram_manage_insights` under **Edit permissions**, or analytics reads nothing for these channels. Peal doesn't use `ads_management` or `ads_read` through this sign-in, so leave them out if Meta's editor lets you.

3. **Register the redirect URL**

    Give the configuration the address [the command](#platform-addresses) prints as **Redirect URL (API setup with Unified login)**.

4. **Set the configuration's id**

    Copy the configuration's id into `META_INSTAGRAM_CONFIG_ID` and restart the server. It isn't a secret: it's in the sign-in's address.

Meta grants a configuration's permissions all or none. A member can't decline insights or comments, and Meta's consent page lists every permission, messages included, even when your inbox doesn't read Instagram's. Meta always adds `instagram_manage_messages`, and you can't remove it.

Saving the configuration gives its permissions Standard Access, for people with a role on the app. Anyone else needs Advanced Access to each permission of the configuration, `instagram_manage_messages` included, and the app in Live mode. Until then, keep Facebook Login offered beside it.

To test in development mode, invite the Instagram account as an Instagram tester under **App roles**, and accept the invitation in Instagram on the web (**Settings** > **Website permissions** > **Apps and websites** > **Tester invites**). Meta asks that the business portfolio that owns the account isn't the one that owns your app.

A configuration set to give tokens for 60 days makes its channels need reconnecting when they end, because renewing them would take `business_management`, which Peal doesn't ask. Unsetting `META_INSTAGRAM_CONFIG_ID` stops new connections that way. Channels already connected through it keep publishing, but can't be reconnected until it's set again.

The command also prints a **Webhooks** callback URL for Facebook Login and one for Instagram. Meta calls it to tell your server that an account's direct messages changed. The server takes those events only once `META_WEBHOOK_VERIFY_TOKEN` is set, and you give its value as the **Verify Token** next to the address.

The address must answer Meta with no login page in front of it, and Meta sends events only from a published (Live) app. The server checks each event's signature with its app's secret before reading it, and reads nothing from it but ids.

Meta fetches the images and videos it publishes from links to the media store, valid for two hours. The store must answer Meta's servers on the internet, through presigned links or `PEAL_MEDIA_PUBLIC_BASE_URL`.

The server signs every call through Facebook Login and Unified login with the main app's secret, so you can turn on **Require App Secret** in the app's advanced settings. Calls with an Instagram Login token carry no proof.

While the app is in development mode, only people with a role on it can connect their accounts. Add yourself, Instagram testers and Threads testers under App roles. To serve other people, each use case needs Meta's App Review of each permission, and Business Verification.

Instagram accounts must be professional ones (business or creator). Through Unified login they belong to a business portfolio, and through Facebook Login they're linked to a Facebook Page. Each account publishes at most 100 posts in 24 hours through Meta's API, and Peal checks that before each one.

**Comments in the inbox**

To read and answer comments on Facebook Pages and Instagram in the [inbox](/guides/engage/inbox#meta), set `PEAL_INBOX_PLATFORMS` to `facebook`, `instagram` or both. Then add the comment permissions to the use cases:

- `pages_read_user_content` and `pages_manage_engagement` to Facebook Login, for Pages
- `instagram_manage_comments` to Facebook Login, for Instagram (the Unified login configuration holds it already)
- `instagram_business_manage_comments` to the Instagram use case

The sign-ins then ask for them, and a member may decline them. Meta grants them at once for accounts your own app's people manage, and for anyone else's only after its App Review.

**Direct messages in the inbox**

To read and answer Messenger's and Instagram's direct messages in the [inbox](/guides/engage/inbox#meta-messages), add `facebook`, `instagram` or both to `PEAL_INBOX_MESSAGES`, and set `META_WEBHOOK_VERIFY_TOKEN`. Then add the messaging permissions to the use cases:

- `pages_messaging` and `pages_manage_metadata` to Facebook Login, for Pages
- `instagram_manage_messages`, `pages_manage_metadata` and `pages_messaging` to Facebook Login, for Instagram
- `instagram_business_manage_messages` to the Instagram use case

A sign-in asks for them only when a member turns a channel's messages on. Peal doesn't read direct messages through Unified login, so a channel connected that way has no switch in the message settings.

In the Webhooks settings, give each of the two callback addresses [the command](#platform-addresses) prints the Verify Token. Subscribe to the `messages` and `message_echoes` fields for the Page object and the Instagram object of Facebook Login, and for Instagram Login. The address must answer Meta with no login page in front of it, and the app must be published (Live), because Meta sends events only from a published app.

Peal asks Meta to send each account's events (`subscribed_apps`) when it first reads the account, then once a day. It asks Meta to stop when the channel's messages are turned off or the channel is disconnected.

Deleting a workspace asks the same for each of its channels, in the background, for two minutes at most. A channel Meta hasn't let go of by then is counted in the metric `peal.channels.release.left_subscribed`, which the alert "Meta still sends an erased workspace's messages" reports. The server also logs a warning, "A channel's platform still sends its events after an erasure", with these fields:

- `channelId` and `platform`
- `accountId`, a Facebook Page's id or an Instagram account's
- `connection`, on Instagram only: `facebookLogin` through the Page linked to it, or `instagramLogin` on its own

Meta then goes on sending that account's messages until the app is removed. Peal ignores them and never stores them. To stop them:

1. Find the account's id in the warning.
2. Ask the owner of the Page or the account, or the organisation whose workspace was deleted, to remove the app under the Page's **Business integrations** settings (for Instagram Login, the account's **Apps and websites**).
3. Or, for a Page, remove the subscription from your app's side. Call `DELETE /{page-id}/subscribed_apps` on the Graph API with your app's app access token. Meta's [reference](https://developers.facebook.com/docs/graph-api/reference/page/subscribed_apps/) says "An app can remove its own webhook subscription from a Page with an App Access Token". Meta documents no such call for Instagram Login.

Before its App Review, an app can read and answer only the messages of people with a role on it, written to accounts they manage too. Meta's review of `pages_messaging`, `pages_manage_metadata`, `instagram_manage_messages` and `instagram_business_manage_messages` asks for screen recordings of a sign-in, of a message sent from the app and seen in Meta's own inbox, and of how a member subscribes the account to its events. Reading Instagram's messages through a Page also needs your business verified. The Instagram account's owner turns on **Allow access to messages** in its Connected tools settings.

Past Meta's 24 hours, a member can still answer by hand for 7 days after the person's last message, with Meta's `HUMAN_AGENT` tag. That needs Meta to review your app's Human Agent feature separately, and your business verified. Once it has, set `PEAL_META_HUMAN_AGENT` to `true`, and leave it unset until then. Only a member signed in to the web app sends such an answer, and Meta's review asks to see that person answer in your inbox.

**Data deletion requests**

When one of its users asks Meta to delete what Peal holds about them, Meta calls the data deletion address with a request signed with that use case's secret. Peal checks the signature. In every workspace, it deletes the channels that person connected through that use case and their tokens, and the accounts their sign-in still offers a member to choose from. It answers with a confirmation code and the page that shows the request's status, `PUBLIC_URL/data-deletion/<code>`.

Meta may retry the same request. It gets the same answer, and nothing more is deleted. An Instagram request names the account by its app-scoped id or by its own id, and Peal takes either. A Unified login channel belongs to a business portfolio, and Peal keeps no id of the person who signed in: through the main app, a request reaches it when it names the business's system user or the account, never that person.

**Deauthorize callbacks**

When someone removes Peal from their account, Meta calls the deauthorize address the same way. In every workspace, Peal marks the channels that person connected through it to be reconnected, and tells the members who manage them. It deletes nothing. A channel connected again since the request was made is left as it is.

## YouTube [#youtube]

To connect YouTube channels, make an OAuth client in a Google Cloud project.

1. **Create a project**

    In the Google Cloud console, create a project, and turn on the **YouTube Data API v3** under APIs and services.

2. **Set up the consent screen**

    Under **Google Auth Platform**, set up the consent screen for **External** users, and add the scopes `https://www.googleapis.com/auth/youtube.upload` and `https://www.googleapis.com/auth/youtube.readonly`.

3. **Create the client**

    Under **Clients**, create a **Web application** client, with the address [the command](#platform-addresses) prints for YouTube as an authorized redirect URI.

4. **Set the credentials**

    Put the client id in `YOUTUBE_CLIENT_ID` and its secret in `YOUTUBE_CLIENT_SECRET`.

Members sign in with Google and pick the channel, a brand account's included, on Google's account chooser. One connection is one channel. Peal asks to upload videos and to read the channel and its videos, nothing more.

Peal's access lasts an hour. It renews it when it uploads or reads counts, and once a month for a channel it does nothing with. Disconnecting a channel revokes that access at Google, unless another workspace still connects the same channel.

> **A consent screen in Testing ends access after seven days**
>
> While the project's consent screen is in **Testing**, only the test users you
> list can sign in. Google ends their access seven days after they connect, so
> their channels have to be reconnected, and Peal tells the workspace. To serve
> anyone for good, publish the consent screen and have Google verify the app for
> its scopes.

The server uploads each video in parts of 8 MiB, holding one at a time. An upload that's cut off, even by a restart, resumes from where YouTube stands. Peal counts against two of the project's quotas:

| Quota         | Per day                                                                                   | What Peal does                                                                                                                                                          |
| ------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Video Uploads | 100 unless Google grants more, reset at midnight Pacific Time                             | Counts uploads for the whole server. An upload past `YOUTUBE_DAILY_UPLOADS`, or one YouTube refuses for its quota or the channel's daily limit, waits for the next day. |
| The other one | 10,000 units, for processing polls, analytics and custom thumbnails (about 50 units each) | Sets up to `YOUTUBE_DAILY_THUMBNAILS` thumbnails a day (80). A video past them goes out with the thumbnail YouTube picks.                                               |

Until November 2026, Google kept the videos of API projects it hadn't audited private. It no longer does, but a channel's settings or Google's restrictions can still keep a video private. Peal compares what YouTube answers with the visibility the member chose, and says so on the post's page.

**Comments in the inbox**

To read and answer YouTube comments in the [inbox](/guides/engage/inbox#youtube), add `youtube` to `PEAL_INBOX_PLATFORMS`, and add the scope `https://www.googleapis.com/auth/youtube.force-ssl` to the consent screen. The sign-in then asks for it, as optional, so an owner can untick it and still connect.

It's a sensitive scope. Google verifies an app that asks for it before anyone but its test users can grant it. The verification asks you to show what the app does with comments, which you can record with the setting on.

By default, Peal splits the project's 10,000 daily units in three:

| Share      | Units                                                               | For                                                                                                                           |
| ---------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Comments   | At most 3,000 (`YOUTUBE_DAILY_COMMENT_UNITS`)                       | Comment reads                                                                                                                 |
| Thumbnails | About 4,000 (`YOUTUBE_DAILY_THUMBNAILS`, 80 at about 50 units each) | Custom thumbnails                                                                                                             |
| The rest   | 3,000                                                               | What Peal doesn't count: replies, hides and withdrawals (50 units each), publishing's status reads and lookups, and analytics |

Ask Google for a larger quota before many channels use the inbox.

## Pinterest [#pinterest]

To connect Pinterest accounts, register an app on Pinterest's developer site.

1. **Connect an app**

    On `developers.pinterest.com`, under **My apps**, connect an app, with a link to your privacy policy. Pinterest reviews the request and grants **Trial access**.

2. **Add the redirect URI**

    In the app's settings, add `PUBLIC_URL/connect/pinterest/callback` as a redirect URI, such as `https://peal.example.com/connect/pinterest/callback`. Pinterest takes the exact address only.

3. **Set the credentials**

    Put the app id in `PINTEREST_APP_ID` and its secret key in `PINTEREST_APP_SECRET`.

Members sign in on Pinterest and allow Peal to read their boards and Pins, to create Pins and to read their account. Peal asks for `boards:read`, `boards:write`, `pins:read`, `pins:write` and `user_accounts:read`, and nothing about secret boards.

Access lasts 30 days. Peal renews it a week ahead, with a refresh token that Pinterest keeps valid for 60 days after each renewal. Pinterest's API doesn't revoke a member's access, so disconnecting a channel deletes Peal's tokens, and the member removes the app in their Pinterest settings.

What the app can do depends on its access:

| Access              | Limits                                                      | What it publishes                                                                                                      | Setting                                                                        |
| ------------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| **Trial access**    | 1,000 calls a day in all                                    | Boards and Pins seen by their creator alone, in Pinterest's Sandbox, which creates no video Pin and gives no analytics | `PINTEREST_SANDBOX=true`, so that the server calls `api-sandbox.pinterest.com` |
| **Standard access** | 100 writes and 60 analytics reads a minute for each account | Real Pins                                                                                                              | `PINTEREST_SANDBOX` unset                                                      |

To publish for real, ask Pinterest for **Standard access** from the app's page. Send a video of your server signing a member in through Pinterest and creating a Pin.

> **Leaving the Sandbox means reconnecting every account**
>
> Once Standard access is granted, unset `PINTEREST_SANDBOX`, and have members
> connect their accounts again. A Sandbox token works nowhere else.

Pinterest fetches a Pin's images from links to the media store, valid for two hours. The store must answer Pinterest's servers on the internet, through presigned links or `PEAL_MEDIA_PUBLIC_BASE_URL`.

Pinterest's developer guidelines ask that the member who publishes a Pin chooses it, which scheduling a post does. They also limit what an app may keep of what it reads. Peal keeps a Pin's id and its counts, for the workspace that published it.

## Google Business Profile [#google-business]

To connect Business Profile locations, Google must first give one of your Google Cloud projects access to the Business Profile APIs, which it does on request.

1. **Pick a project**

    In the Google Cloud console, create a project, or pick one, and note its project number.

2. **Ask Google for access**

    Use the [GBP API contact form](https://support.google.com/business/contact/api_default) and select **Application for Basic API Access**. Send it from an email address that owns or manages a Business Profile. Google asks that the profile be verified and active for 60 days or more, and that the business have a website. It answers by email once it has reviewed the request.

3. **Check the quota**

    Look at the project's quota for the Business Profile APIs. 300 requests a minute means access is granted, and 0 means it isn't yet. A quota increase doesn't replace the request.

4. **Enable the APIs**

    Under APIs and services, enable the **Google My Business API**, which makes the posts and shows in the console only once access is granted. Also enable the **My Business Account Management API** and the **My Business Business Information API**, which list accounts and locations.

5. **Set up the consent screen**

    Under **Google Auth Platform**, set up the consent screen for **External** users, and add the scope `https://www.googleapis.com/auth/business.manage`.

6. **Create the client**

    Under **Clients**, create a **Web application** client, with `PUBLIC_URL/connect/googleBusiness/callback` as an authorized redirect URI, such as `https://peal.example.com/connect/googleBusiness/callback`.

7. **Set the credentials**

    Put the client id in `GOOGLE_BUSINESS_CLIENT_ID` and its secret in `GOOGLE_BUSINESS_CLIENT_SECRET`.

This client is separate from YouTube's, because Google gives access, counts quota and reviews apps project by project. A project that has both products can serve both. Give the same client id and secret under both names, with both redirect URIs on the client.

Members sign in with Google and choose among the verified locations of the accounts they own or manage, 200 at most per sign-in. One connection is one location.

Peal lists accounts and locations when a member connects, makes posts, and reads a location's posts back when Google's answer to one was lost. It changes nothing else on a profile.

Where `PEAL_INBOX_PLATFORMS` names `googleBusiness`, Peal also reads each location's [reviews](/guides/engage/inbox#reviews) hourly or every six hours. It answers a review, or deletes the location's reply, when a member asks. Otherwise it reads no reviews. Before turning that on, read, answer and delete the reply of one review on a test location.

Peal's access lasts an hour. It renews it whenever it posts, and at least once a month for a location it posts nothing to, so Google never drops it. Disconnecting a location revokes that access at Google, unless another workspace still connects the same location.

While the project has no access, Google answers every call with 429. Connecting fails as if the platform weren't answering, and the server's log says to check the project. While the consent screen is in **Testing**, only its test users can sign in, and Google ends their access after seven days, as for YouTube.

Google fetches each photo from a link to the media store, valid for two hours. The store must answer Google's servers on the internet, through presigned links or `PEAL_MEDIA_PUBLIC_BASE_URL`. Every call draws on the project's 300 requests a minute. Past them, a post waits and goes out a little later.

> **Google's policies bind you**
>
> Google's [policies for these
> APIs](https://developers.google.com/my-business/content/policies) bind you as
> the project's owner. Among them, you must act only for businesses whose owners
> or managers signed in themselves, and tell them of a change to their profile
> within 48 hours. Peal tells a post's author in the app once it's live, and by
> email if they chose that. You must also let a business leave, which
> disconnecting a channel does, and store what the APIs answer only within the
> limits Google sets. Of that, Peal keeps a location's name and address, which
> label its channel, and each post's name and address on Google, until the
> channel is disconnected or the workspace deleted. Read the policies, and
> decide whether that suits your use.

## Slack [#slack]

To connect Slack channels, register an app on Slack and turn on its public distribution, so that other Slack workspaces can install it.

1. **Create an app**

    At `api.slack.com/apps`, create an app from scratch in a Slack workspace of yours, named after your service.

2. **Add its scopes and redirect URL**

    Under **OAuth & Permissions**, add the bot token scopes `incoming-webhook`, `chat:write`, `chat:write.public` and `files:write`. Add `PUBLIC_URL/connect/slack/callback` as a redirect URL, such as `https://peal.example.com/connect/slack/callback`.

    Leave token rotation off. Slack can't turn it off again once it's on, and Peal never renews a token.

3. **Distribute it**

    Under **Manage Distribution**, activate public distribution. You don't need a listing in Slack's directory.

4. **Set the credentials**

    Put the app's client ID in `SLACK_CLIENT_ID` and its client secret in `SLACK_CLIENT_SECRET`.

Members add the app to their Slack workspace, and on Slack's page they pick the channel it posts to. Peal never lists a workspace's channels, and asks for no scope that reads channels, messages or files.

The bot's token doesn't expire. If Slack refuses it, as it does once the app is removed from the workspace, the channel shows **Reconnect**. Disconnecting a channel revokes nothing, because the same token serves every channel of that Slack workspace.

These settings have nothing to do with `SLACK_ALERTS_WEBHOOK_URL`, where the monitoring sends its alerts.

## Snapchat [#snapchat]

To connect Snapchat Public Profiles, make an OAuth app in Snap's Business Manager, ask Snap to allowlist it for its Public Profile API, and set its credentials once Snap has.

1. **Make a business account**

    In Snap's Ads Manager, make a business account (an organization) for your service. Ads Manager offers to make the Snapchat account you sign in with the business's Public Profile (**Create Public Profile**). To try your server, you need a Snapchat account that has a Public Profile.

2. **Make the OAuth app**

    In Business Manager, under **Business Details**, open **OAuth Apps** and click **+ OAuth App**. Only an Organization Admin sees it, and the first time Snap asks you to accept the Snap Developer Terms and the Snap Business Tools Terms for the organization. Don't make the app in Snap's Developer Portal: the Public Profile API refuses its client ids.

    Give it a name and, under **Snap Redirect URIs**, the address [the command](#platform-addresses) prints, `PUBLIC_URL/connect/snapchat/callback`, such as `https://peal.example.com/connect/snapchat/callback`. The field takes one address a line, up to 10, so one app can serve several servers. Check them first: Snap warns that the name and the redirect URIs can't be changed once the app is made.

3. **Keep the credentials**

    Snap shows the client id and the client secret once the app is made, and the secret only then: keep both somewhere safe. Don't set them on the server yet.

4. **Ask Snap to allowlist the app**

    The Public Profile API takes only the client ids Snap has allowlisted. Send your Snap contact the client id and what your service does with the API, never the secret.

5. **Set the credentials**

    Once Snap says it has allowlisted the id, put it in `SNAPCHAT_CLIENT_ID` and the secret in `SNAPCHAT_CLIENT_SECRET`. The server offers Snapchat as soon as both are set, so set them only then: before, every sign-in fails, and the server's log says Snap refused the client.

Members sign in on Snapchat and allow Peal to reach their Public Profile. Peal asks for the one scope `snapchat-profile-api`. Access lasts an hour, and Peal renews it. Snap documents no call that revokes access, so disconnecting a channel deletes Peal's tokens and tells Snapchat nothing.

## WordPress websites [#wordpress]

A WordPress site needs no app. A member connects it with its address, a user and an application password made on that user's profile page ([Websites and articles](/guides/channels/websites)). The server keeps the password encrypted with `PEAL_TOKEN_KEYS`.

Peal reaches the site's REST API over HTTPS on the default port, at public addresses only, redirects included. A site on your own network needs its host name, or address, in `PEAL_OUTBOUND_ALLOWED_HOSTS` ([Environment variables](/self-hosting/environment-variables#channels)). List only hosts you'd trust every member with, because this is how a request could reach a service inside your network.

## WordPress.com [#wordpress-com]

To connect sites on WordPress.com, and the Jetpack sites members reach there, register an application on WordPress.com. WordPress.com documents no review for one.

1. **Create an application**

    At `developer.wordpress.com/apps`, signed in with the WordPress.com account that will own it, create an application of type **Web**. Name it after your service, and give your website's address and a description.

2. **Add the redirect URL**

    Give `PUBLIC_URL/connect/wordpress-com/callback` as its redirect URL, such as `https://peal.example.com/connect/wordpress-com/callback`. WordPress.com takes the exact address only.

3. **Set the credentials**

    Put the application's client ID in `WORDPRESS_COM_CLIENT_ID` and its client secret in `WORDPRESS_COM_CLIENT_SECRET`.

Members sign in on WordPress.com and pick one site. Peal asks for no scope, because WordPress.com's default gives the application that one site. Peal calls the site's core routes through `public-api.wordpress.com`, as it calls a WordPress site of its own.

WordPress.com documents neither an expiry nor a refresh for these tokens. When it refuses one, the channel is marked **Reconnect**.

## DEV and Hashnode [#devto-hashnode]

DEV and Hashnode need no app. A member connects an account with a key made there (an API key on DEV, a personal access token on Hashnode), which the server keeps encrypted with `PEAL_TOKEN_KEYS`. Hashnode answers its API only for a publication on its Pro plan, which the member pays for on Hashnode.
