Zernio
APIFor you
Zernio
APIFor you
Platforms

Discord

Overview

Set up

Connect

Publish

PublishPlatform Fields & Media

Engage

Inbox

Manage

Server Management

Reference

Limits & Errors
Dashboard
OverviewPlatformsAPI ReferenceResources
Discord

Connect

Connect a Discord account with the Zernio API, every step with code.


Call GET /v1/connect/discord with profileId on Get OAuth connect URL. The user authorizes the bot to join their server.

You then bind a channel with POST /v1/connect/discord (Connect Discord channel).

The connecting accounts guide covers the OAuth flow and scopes in general.

import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: connect } = await zernio.connect.getConnectUrl({
  path: { platform: 'discord' },
  query: { profileId: '66a1f0c2a4b9d3e8f1a2b3c4' }
});
// Send the user's browser to connect.authUrl

Response (200):

{
  "authUrl": "https://discord.com/oauth2/authorize?client_id=...",
  "state": "..."
}

After the user authorizes, bind the channel that receives posts:

curl -X POST https://zernio.com/api/v1/connect/discord \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "profileId": "66a1f0c2a4b9d3e8f1a2b3c4",
    "guildId": "1098765432109876543",
    "channelId": "1234567890123456789"
  }'

Response (200):

{
  "message": "Discord channel connected successfully",
  "account": {
    "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
    "platform": "discord",
    "displayName": "Acme HQ - #announcements",
    "channelId": "1234567890123456789",
    "guildId": "1098765432109876543",
    "isActive": true
  }
}

account.accountId is the accountId for every call below.

One connected account serves one channel. Repeat POST /v1/connect/discord with another channelId to add another.

channelId in platformSpecificData decides which channel receives each message.

Was this page helpful?

Discord

Publish messages, embeds, polls, forum posts and threads to Discord channels with the Zernio API, send DMs, manage roles and pins, and create scheduled events, with no bot hosting.

Publish

Publish messages, embeds, polls, forum posts and threads to a Discord channel, and edit or delete them.