DEV Community

Cover image for Put GPT-6 Astra in Discord and Telegram: Build a Dify Writing Bot with LangBot
Rock
Rock

Posted on Fully Autonomous

Put GPT-6 Astra in Discord and Telegram: Build a Dify Writing Bot with LangBot

A community announcement usually starts as a few rough notes: a date, a channel, and something people need to bring. The first draft is easy. The annoying part is reopening another app for every “make it shorter” or “turn that into a Telegram reminder.”

I built a small writing assistant that keeps those revisions in the conversation. Dify owns the prompt and chat history, GPT-6 Astra writes the response, and LangBot provides the messaging-platform entry point. Here is the complete setup, including the local deployment and the replies I tested.

A real response from Dify and Astra, shown in LangBot Debug Chat.

A real response from Dify and Astra, shown in LangBot Debug Chat.

Start with a working Dify and LangBot installation

You need Docker Compose, Git, Python 3, and credentials for a provider that exposes gpt-6-astra. I deployed Dify 1.17.1 and LangBot v4.10.11 locally for this walkthrough. The screenshots show those running installations in English.

The repository includes a small setup wrapper so the ports and Docker network match this article. Run it from a location without an existing tutorial-runtime directory:

git clone https://github.com/langbot-app/langbot-marketing.git
cd langbot-marketing
bash series/dify-gpt-6-astra/examples/setup-local.sh
Enter fullscreen mode Exit fullscreen mode

The wrapper clones the pinned Dify release, generates local service passwords, and starts LangBot with its plugin runtime. It contains no model credentials. Allow time for the first image downloads and leave enough memory and disk space for the Dify stack.

Initialize Dify at http://localhost:8088 and LangBot at http://localhost:5368. Create your own administrator accounts and choose English in both interfaces.

The first-run screen of the local Dify deployment.

The first-run screen of the local Dify deployment.

The local LangBot installation before administrator setup.

The local LangBot installation before administrator setup.

There are two different addresses to keep straight: your browser opens Dify at http://localhost:8088; LangBot calls it at http://nginx/v1 over the shared Docker network. Using the browser's localhost address inside the LangBot container will point at the wrong service.

Connect GPT-6 Astra to Dify

Open Integrations → Model Provider, install the official OpenAI-API-compatible provider, and choose Add Model. I tested provider version 0.0.66 with an OpenAI-compatible gateway.

Field Tutorial setting
Model Name / endpoint model name gpt-6-astra
Model Type / Completion mode LLM / Chat
Model display name GPT-6 Astra
API Base URL Your provider's compatible endpoint, usually ending in /v1
API Key Your own provider key
API Type Chat Completions API
Context size / maximum-token ceiling 32768 / 4096 for this example

Those limits are conservative settings for this tutorial, not a statement of Astra's full specifications. Save the model and let Dify validate the connection. Replace the gateway shown in the screenshot with your own authorized endpoint. Provider capabilities can differ; see the official GPT-6 Astra guide when configuring direct OpenAI access.

The custom model form, captured before entering the API key.

The custom model form, captured before entering the API key.

Build a basic Chatbot

In Dify Studio, choose Create → Create from Blank → More basic app types → Chatbot. Name it Astra Writing Assistant. A basic Chatbot is enough here: we need a clear prompt and conversation history, without a branching workflow.

Dify keeps its basic Chatbot option under More basic app types.

Dify keeps its basic Chatbot option under More basic app types.

Give the assistant a name and a specific job.

Give the assistant a name and a specific job.

Select GPT-6 Astra under Configure model, then add these instructions:

You help a community manager turn rough notes into messages people can use.
Reply in the language of the user's request.
For an announcement, give: one clear headline, a short ready-to-send message,
and one optional reminder.
Preserve supplied dates, times, links, and requirements exactly.
Never invent missing event details, discounts, results, or promises.
If an essential detail is missing, ask one concise question.
Use a natural, direct tone. Avoid hype and excessive emojis.
Keep a typical reply under 180 words. When revising, use conversation context.
Enter fullscreen mode Exit fullscreen mode

The most useful line is the one about preserving details. An announcement can survive plain wording. It cannot survive an invented RSVP link or the wrong time zone. I also kept the output short enough to be useful in a channel.

The prompt gives the assistant a narrow job and clear boundaries.

The prompt gives the assistant a narrow job and clear boundaries.

For the first test, I entered:

Write a Discord announcement: community demo day is September 22 at 18:00 UTC. Bring one bot demo. RSVP in #demo-day. Keep it friendly and under 100 words.

The response preserved the date, time, and channel. I then asked, “Make it shorter, and remove the optional reminder.” The second reply kept the details from the first turn without asking me to paste them again.

The first English announcement generated in Dify.

The first English announcement generated in Dify.

A follow-up instruction revises the existing announcement.

A follow-up instruction revises the existing announcement.

Publish the updated configuration with Publish Update. This step matters: an external caller should receive the version you just tested, rather than an older prompt still attached to the published app.

The published app exposes a backend API for LangBot.

The published app exposes a backend API for LangBot.

Put LangBot in front of the app

Publish the saved version in Dify. Open Access Point → Backend Service API → API Key and create a key for this app.

In LangBot, choose Create Pipelines, name the pipeline Astra Writing Assistant, and open Configuration → AI:

Field Value
Runner Dify Service API
Base URL http://nginx/v1
App Type Chat
API Key The Dify app key you just created

The Dify app key belongs here. The Astra provider key stays in Dify. Save the pipeline, then use Debug Chat to check the complete request and response path before adding a messaging platform.

The LangBot pipeline settings, captured before entering the app key.

The LangBot pipeline settings, captured before entering the app key.

Test the same task through LangBot

I asked LangBot for a two-sentence Telegram reminder. The reply came back through Dify with the supplied date and time intact. A later request switched the same conversation to Chinese, which also worked.

For a community server, I would start with mention-based triggers in a single channel. Let members ask for a draft, shorten it, and adjust the tone before they decide to post it. That small loop is already useful for release announcements, event reminders, and repeated support replies.

The writing assistant answering through the LangBot pipeline.

The writing assistant answering through the LangBot pipeline.

Connect it to Discord and Telegram

Choose Create Bots in LangBot, select your adapter, and enter credentials from that platform. After creating the bot, select the pipeline you just built. Check the pipeline's trigger rules for direct messages, group messages, and mentions before inviting it into a channel.

The measured path in this walkthrough is LangBot → Dify → GPT-6 Astra → LangBot. I inspected the real adapter forms below; I did not authorize a live Slack workspace, Discord server, Telegram bot, or LINE account for this demo.

Platform Setup path
Slack Create a Slack app, grant the required bot scopes, install it to the workspace, and enter the Bot Token and Signing Secret in LangBot. Configure event subscriptions with the public HTTPS callback from the bot setup, verify it, and invite the bot to the intended channel.
Discord Create an application and bot in the Developer Portal. Enter Client ID and bot Token, enable the required message intents, then invite the bot with the appropriate channel permissions.
Telegram Create a bot with BotFather and enter its token. Start with a direct message; for groups, invite the bot and configure privacy mode and LangBot's trigger rules for the messages it should receive.
LINE Create a Messaging API channel. Enter the Channel access token and Channel secret, configure the public HTTPS webhook, enable webhook delivery, and avoid conflicting automatic replies.
Mattermost Enter the server URL and a Bot Account access token, then add that account to the relevant teams and channels. The adapter uses REST and WebSocket APIs.

The Discord adapter uses the application Client ID and bot token.

The Discord adapter uses the application Client ID and bot token.

The Telegram adapter uses a BotFather token and exposes reply options.

The Telegram adapter uses a BotFather token and exposes reply options.

The catalog also includes Matrix, Lark, DingTalk, WeCom, WeChat-related adapters, QQ, KOOK, OneBot v11, Satori, HTTP Bot, and Page Bot. See the platform-specific LangBot guides for the permissions and networking required by each adapter. In particular, the local-only deployment above needs a suitable public HTTPS endpoint for webhook-based integrations such as Slack and LINE.

Files and troubleshooting

Use the exported Dify app or follow the deployment and import notes. Select your own model after importing. For a knowledge app, replace the example's instance-specific knowledge reference with your own dataset.

When something fails, check the path in order: Dify preview, the published app version, LangBot's /v1 base URL and app type, then the platform's event delivery. If you change Dify service passwords, keep Redis and Celery credentials aligned, and do the same for Sandbox and its code-execution client.

My local proxy initially returned fake DNS addresses that Dify's SSRF proxy rejected. Correcting DNS fixed the plugin download without disabling network protections. For external API calls, inspect the run record after a retry rather than assuming that a transport error means the app configuration is wrong.

Sources and files: LangBot, Dify, and this tutorial's screenshots and configuration. The deployment and screenshots are from September 16, 2026; later versions may move some controls.

Top comments (0)