Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cache/plugin/social/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
502 changes: 502 additions & 0 deletions docs/tutorials/create-and-host-go-ai-telegram-bot.md

Large diffs are not rendered by default.

Binary file modified get-started/.gitbook/assets/url-env-variable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions get-started/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@
* [Django](backend/python/django.md)
* [Flask](backend/python/flask.md)
* [Python Discord Bot](backend/python/python-discord-bot.md)
* [Python Telegram Bot](backend/python/python-telegram-bot.md)
* [Deploy a Python Telegram Bot in 5 Minutes](backend/python/python-telegram-bot.md)
* [Polling Python Telegram Bot](backend/python/polling-python-telegram-bot.md)
* [WhatsApp Bot](backend/python/whatsapp-bot.md)
* [Whatsapp Bot](backend/python/whatsapp-bot.md)
* [Node.js](backend/node.js/README.md)
* [Express.js](backend/node.js/express.js.md)
* [Node.js Discord Bot](backend/node.js/node.js-discord-bot.md)
* [Node.js Telegram Bot](backend/node.js/node.js-telegram-bot.md)
* [Deploy a Node.js Telegram Bot in 5 Minutes](backend/node.js/node.js-telegram-bot.md)
* [Polling Node Telegram Bot](backend/node.js/polling-node-telegram-bot.md)
* [Slack Bot](backend/node.js/slack-bot.md)
* [Java](backend/java.md)
* [Go](backend/go.md)
* [Go](backend/go/README.md)
* [Go](backend/go/go.md)
* [Deploy a Go Telegram Bot in 5 Minutes](backend/go/go-telegram-bot.md)
* [Docker](backend/docker/README.md)
* [Caddy Docker Site](backend/docker/caddy-docker-site.md)
* [Docker Laravel App](backend/docker/docker-laravel-app.md)
Expand All @@ -52,5 +54,5 @@
* [Flask + HTMX](full-stack/flask-+-htmx.md)
* [MEAN Stack](full-stack/mean-stack.md)
* [MERN Stack](full-stack/mern-stack.md)
* [Persistent Storage](peristent-storage.md)
* [Peristent Storage](peristent-storage.md)
* [WordPress](wordpress.md)
2 changes: 2 additions & 0 deletions get-started/backend/go/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Go

101 changes: 101 additions & 0 deletions get-started/backend/go/go-telegram-bot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
description: Learn how to deploy a Go Telegram Bot from GitHub.
---

# Go Telegram Bot

Deploy a Go Telegram Bot and learn how to host backend code on Code Capsules.

## Register the Bot

Before you can create a Telegram bot, you need a Telegram user account. Open Telegram and create an account if you don't already have one.

When you've signed in to Telegram, search for `BotFather` (a bot for managing all other Telegram bots) and start a new chat with it.

Follow the steps below to register a new bot with the BotFather:

1. Type `/start` and press send.
2. Type `/newbot` and press send.
3. Choose a name for your bot.
4. Choose a username for your bot that ends in `bot`.

The BotFather will respond with a message containing an access token for your newly created bot. This access token allows our application to:

- Access the Telegram API.
- Tell our bot what to do when receiving different messages from users.

To confirm that your bot has been created successfully, search for the bot's username. You should be able to see it and start a conversation with it. However, it won't respond because we haven't written the bot's logic yet.

## Setup

Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you need a [Code Capsules](https://codecapsules.io/) account and a [GitHub](https://github.com/) account.

To demonstrate how to deploy a Go Telegram Bot with Code Capsules, we've provided an example bot in the [Code Capsules GitHub repository](https://github.com/codecapsules-io/go-telegram-echobot).

Sign in to GitHub, and fork the example bot repository by clicking **Fork** at the top right of your screen and selecting your GitHub account as the destination.

## Create a Space for Your Bot

Log in to your Code Capsules account and navigate to the **Spaces** tab. Then, click the yellow **+** icon at the bottom left of the screen to add a new Space.

Follow the prompts to choose your region and give your Space a name, then click **Create Space**.

![Create a Space](<../../.gitbook/assets/space-name (3).png>)

Example instructions to go with numbered annotations:

1. Choose a Team. You can use a default "personal" Team if you're the only person working on this project, or a named Team if you're collaborating with others.
2. The name should remind you of the project, for example, `customer-api` or `notetaking-app`.
3. Choose a country close to where most of your users reside.

## Create the Capsule

A [Capsule](https://docs.codecapsules.io/platform/capsules/what-is-a-capsule) provides the server for hosting an application on Code Capsules.

To create a new Capsule for your Space, follow the instructions below:

1. Click the add Capsule **+** button in your Space.
2. Choose **Backend** for the Capsule type, and select your Team and Space, if not already populated.
3. Choose your payment plan and click **Next**.
4. Click the **Configure Git for Code Capsules** button and grant access to your forked **`go-telegram-echobot`** repository.
5. Press **Next**.
6. Leave the **Run Command** blank.
7. Click **Create Capsule**.

Code Capsules automatically builds your application when you've finished creating the Capsule.

Once your application is live, you can view the build logs by selecting the **Deploy** tab and clicking the **View build log** link in the **Builds** section.

![Build Logs](<../../.gitbook/assets/backend-capsule-build-logs (1).png>)

## Add Environment Variables

Once the build is complete, we need to add the `BOT_TOKEN` and `URL` environment variables on the **Config** tab, under the **Environment Variables** section.

First, name the `BOT_TOKEN` variable and enter your Telegram access token (which you received from the BotFather when you registered the bot) as its **Value**.

![Add a BOT\_TOKEN Environment Variable](../../.gitbook/assets/bot-token-env-variable.png)

Name the `URL` variable and set your bot's domain as its **Value**.

- Get the domain by clicking the Capsule's **Details** tab and copying the URL in the **Public URL** section.
- Paste the URL in the **Value** field.
- Make sure the URL ends with a `/` or the webhook will not be valid.

![Add a URL Environment Variable](../../.gitbook/assets/url-env-variable.png)

Confirm your changes by clicking on **Save**, then restart your Capsule by toggling the radio button in the top-right corner off and on again.

## Set Up Webhook

The next step is to set up a webhook for your bot:

- Click the **Public URL** link in your Capsule's **Details** tab.
- In the new tab that opens, add `/setwebhook` to the URL and press `enter`/`return` to visit the URL.
- If you see `webhook setup ok`, then your bot is ready to chat!

## Chat with the Bot

The bot can now respond to messages! Search for your bot on Telegram using the username you assigned it, and start a chat with it. The bot is programmed to respond to `/start` and echo any messages you send it.

If you'd like to deploy another application in a different language or framework, take a look at our other [deployment guides](https://docs.codecapsules.io/backend).
20 changes: 7 additions & 13 deletions get-started/backend/go.md → get-started/backend/go/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: A guide to deploying a Go application from GitHub.

Deploy a Go application and learn how to host backend code on Code Capsules.

## Setup
## Set up

Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a [Code Capsules](https://codecapsules.io/) account and a [GitHub](https://github.com/) account.

Expand All @@ -22,15 +22,15 @@ If you've just signed up for an account, you'll be directed to a welcome page on

Alternatively, if you're signing in again, click on the "Spaces" tab.

Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at [our explanation](https://app.gitbook.com/s/gIlxo9gU7Lotj1cdGRh6/platform).
Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at [our explanation](../../platform/platform.md).

## Create a Space for Your App
## Create a Space for your App

Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow `+` icon on the bottom left of the screen to add a new Space.

Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".

![Create a Space](<../.gitbook/assets/space-name (1).png>)
![Create a Space](<../../.gitbook/assets/space-name (4).png>)

Example instructions to go with numbered annotations

Expand All @@ -56,20 +56,14 @@ Code Capsules will automatically build your application when you've finished cre

Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.

![Build Logs](../../products/.gitbook/assets/backend-capsule/backend-capsule-build-logs.png)

## Binding the Capsules

Now you need to bind the two capsules together. Navigate to the "Config" tab of the Backend Capsule you've just created. Scroll to the "Bind Data Capsule" section and click on the "Bind". This enables the capsule to use the Persistent database in the Data Capsule.

![Bind Capsules](../.gitbook/assets/bind-persistent-capsule-backend.png)
![Build Logs](<../../.gitbook/assets/backend-capsule-build-logs (1).png>)

## View Application

Restart your capsule by toggling the radio button in the top right off and on again.

Once the build is complete, click the "URL" link in the "Details" tab, and you should see your deployed application.

![Deployed App](../.gitbook/assets/cc-go-app.png)
![Deployed App](../../.gitbook/assets/cc-go-app.png)

If you’d like to deploy another application in a different language or framework, take a look at our other [deployment guides](../).
If you’d like to deploy another application in a different language or framework, take a look at our other [deployment guides](../../).
14 changes: 4 additions & 10 deletions get-started/backend/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: A guide on how to launch a Java application from GitHub.

Deploy a Java application and learn how to host backend code on Code Capsules.

## Setup
## Set Up

Code Capsules connects to GitHub repositories to deploy applications. To follow this guide, you'll need a [Code Capsules](https://codecapsules.io/) account and a [GitHub](https://github.com/) account.

Expand All @@ -24,13 +24,13 @@ Alternatively, if you're signing in again, click on the "Spaces" tab.

Code Capsules gives every account a Personal Team by default. A Team is an environment for you to manage your Spaces and Capsules. For a better understanding of Teams, Spaces, and Capsules, take a look at [our explanation](https://app.gitbook.com/s/gIlxo9gU7Lotj1cdGRh6/platform).

## Create a Space for Your App
## Create a Space for your App

Log in to your Code Capsules account and navigate to the "Spaces" tab. Once there, click the yellow `+` icon on the bottom left of the screen to add a new Space.

Follow the prompts, choosing your region and giving your Space a name, then click "Create Space".

![Create a Space](<../.gitbook/assets/space-name (1).png>)
![Create a Space](<../.gitbook/assets/space-name (4).png>)

Example instructions to go with numbered annotations

Expand All @@ -56,13 +56,7 @@ Code Capsules will automatically build your application when you've finished cre

Once your application is live, you can view the build log by selecting the "Deploy" tab and clicking the "View build log" link in the "Builds" section.

![Build Logs](../../products/.gitbook/assets/backend-capsule/backend-capsule-build-logs.png)

## Binding the Capsules

Now you need to bind the two capsules together. Navigate to the "Config" tab of the Backend Capsule you've just created. Scroll to the "Data capsules" section and click on "Bind". This enables the capsule to use the Persistent database in the Data Capsule.

![Bind MEAN Capsules](../.gitbook/assets/bind-persistent-capsule-backend.png)
![Build Logs](<../.gitbook/assets/backend-capsule-build-logs (1).png>)

## View Application

Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tutorials/.gitbook/assets/bot-api-key-env.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tutorials/.gitbook/assets/telegram-bot-chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tutorials/.gitbook/assets/update-git-branch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 57 additions & 1 deletion tutorials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,60 @@ coverY: 0

# Tutorials Overview

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>A decentralized application (dApp) is a software application that runs on a decentralized network, often…</td><td><a href=".gitbook/assets/How to Deploy a React Token dApp to Code Capsules.png">How to Deploy a React Token dApp to Code Capsules.png</a></td><td><a href="how-to-deploy-a-react-token-dapp-to-code-capsules.md">how-to-deploy-a-react-token-dapp-to-code-capsules.md</a></td></tr><tr><td>Nuxt.js takes Vue to the next level, with SSR and SSG. Find out more about…</td><td><a href=".gitbook/assets/Nuxt3 and Nitro.png">Nuxt3 and Nitro.png</a></td><td><a href="nuxt3-and-nitro.md">nuxt3-and-nitro.md</a></td></tr><tr><td>The MERN stack, which stands for MongoDB, Express.js, React, and Node.js, is a robust framework…</td><td><a href=".gitbook/assets/Optimizing Performance in MERN Stack_ Tips and Techniques.png">Optimizing Performance in MERN Stack_ Tips and Techniques.png</a></td><td><a href="optimizing-performance-in-mern-stack-tips-and-techniques.md">optimizing-performance-in-mern-stack-tips-and-techniques.md</a></td></tr><tr><td>Build a personal API that lets you access up to the minute exchange rates and weather data for cities of your choosing.</td><td><a href=".gitbook/assets/creating-flask-api-cover.jpg">creating-flask-api-cover.jpg</a></td><td><a href="creating-and-hosting-an-api-with-flask/">creating-and-hosting-an-api-with-flask</a></td></tr><tr><td>Create a full stack application with Flask and HTMx to build a lightweight interactive site.</td><td><a href=".gitbook/assets/flask-htmx-cover.png">flask-htmx-cover.png</a></td><td><a href="building-a-full-stack-application-with-flask-and-htmx.md">building-a-full-stack-application-with-flask-and-htmx.md</a></td></tr><tr><td>Learn how to build a Telegram bot that messages you exchange rate data and weather forecasts for areas of your choosing.</td><td><a href=".gitbook/assets/telegram-bot-cover.jpg">telegram-bot-cover.jpg</a></td><td><a href="how-to-create-and-host-a-telegram-bot-on-code-capsules.md">how-to-create-and-host-a-telegram-bot-on-code-capsules.md</a></td></tr><tr><td>Social media bots allow you to automate responses and reactions to posts or messages sent to the bot.</td><td><a href=".gitbook/assets/telegrambot.jpg">telegrambot.jpg</a></td><td><a href="create-and-host-a-telegram-bot-with-node.js-on-code-capsules.md">create-and-host-a-telegram-bot-with-node.js-on-code-capsules.md</a></td></tr><tr><td>Create a bot that monitors the state of your applications and reports any status changes via Slack.</td><td><a href=".gitbook/assets/CodeCapsules_SlackBot.jpg">CodeCapsules_SlackBot.jpg</a></td><td><a href="build-a-slackbot-with-node.js-to-monitor-your-applications.md">build-a-slackbot-with-node.js-to-monitor-your-applications.md</a></td></tr></tbody></table>
<table data-view="cards">
<thead>
<tr>
<th></th>
<th data-hidden data-card-cover data-type="files"></th>
<th data-hidden data-card-target data-type="content-ref"></th>
</tr>
</thead>
<tbody>
<!-- Telegram Bot Tutorials -->
<tr>
<td>Build a Telegram bot that uses AI to respond to users with a custom personality.</td>
<td><a href=".gitbook/assets/telegram-bot-cover.jpg">telegram-bot-cover.jpg</a></td>
<td><a href="how-to-create-and-host-a-telegram-bot-on-code-capsules.md">how-to-create-and-host-a-telegram-bot-on-code-capsules.md</a></td>
</tr>
<tr>
<td>Learn how to build a Telegram bot that messages you exchange rate data and weather forecasts for areas of your choosing.</td>
<td><a href=".gitbook/assets/telegram-bot-cover.jpg">telegram-bot-cover.jpg</a></td>
<td><a href="how-to-create-and-host-a-telegram-bot-on-code-capsules.md">how-to-create-and-host-a-telegram-bot-on-code-capsules.md</a></td>
</tr>
<tr>
<td>Social media bots allow you to automate responses and reactions to posts or messages sent to the bot.</td>
<td><a href=".gitbook/assets/telegrambot.jpg">telegrambot.jpg</a></td>
<td><a href="create-and-host-a-telegram-bot-with-node.js-on-code-capsules.md">create-and-host-a-telegram-bot-with-node.js-on-code-capsules.md</a></td>
</tr>
<tr>
<td>A decentralized application (dApp) is a software application that runs on a decentralized network, often…</td>
<td><a href=".gitbook/assets/How to Deploy a React Token dApp to Code Capsules.png">How to Deploy a React Token dApp to Code Capsules.png</a></td>
<td><a href="how-to-deploy-a-react-token-dapp-to-code-capsules.md">how-to-deploy-a-react-token-dapp-to-code-capsules.md</a></td>
</tr>
<tr>
<td>Nuxt.js takes Vue to the next level, with SSR and SSG. Find out more about…</td>
<td><a href=".gitbook/assets/Nuxt3 and Nitro.png">Nuxt3 and Nitro.png</a></td>
<td><a href="nuxt3-and-nitro.md">nuxt3-and-nitro.md</a></td>
</tr>
<tr>
<td>The MERN stack, which stands for MongoDB, Express.js, React, and Node.js, is a robust framework…</td>
<td><a href=".gitbook/assets/Optimizing Performance in MERN Stack_ Tips and Techniques.png">Optimizing Performance in MERN Stack_ Tips and Techniques.png</a></td>
<td><a href="optimizing-performance-in-mern-stack-tips-and-techniques.md">optimizing-performance-in-mern-stack-tips-and-techniques.md</a></td>
</tr>
<tr>
<td>Build a personal API that lets you access up to the minute exchange rates and weather data for cities of your choosing.</td>
<td><a href=".gitbook/assets/creating-flask-api-cover.jpg">creating-flask-api-cover.jpg</a></td>
<td><a href="creating-and-hosting-an-api-with-flask/">creating-and-hosting-an-api-with-flask</a></td>
</tr>
<tr>
<td>Create a full stack application with Flask and HTMx to build a lightweight interactive site.</td>
<td><a href=".gitbook/assets/flask-htmx-cover.png">flask-htmx-cover.png</a></td>
<td><a href="building-a-full-stack-application-with-flask-and-htmx.md">building-a-full-stack-application-with-flask-and-htmx.md</a></td>
</tr>
<tr>
<td>Create a bot that monitors the state of your applications and reports any status changes via Slack.</td>
<td><a href=".gitbook/assets/CodeCapsules_SlackBot.jpg">CodeCapsules_SlackBot.jpg</a></td>
<td><a href="build-a-slackbot-with-node.js-to-monitor-your-applications.md">build-a-slackbot-with-node.js-to-monitor-your-applications.md</a></td>
</tr>
</tbody>
</table>
4 changes: 3 additions & 1 deletion tutorials/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Table of contents

* [Tutorials Overview](README.md)
* [How to Create and Host an AI-Backed Telegram Bot with Go on Code Capsules](create-and-host-go-ai-telegram-bot.md)
* [How to Create and Host a Telegram Bot on Code Capsules](how-to-create-and-host-a-telegram-bot-on-code-capsules.md)
* [Create and Host a Telegram Bot with Node.js on Code Capsules](create-and-host-a-telegram-bot-with-node.js-on-code-capsules.md)
* [How to Deploy a React Token dApp to Code Capsules](how-to-deploy-a-react-token-dapp-to-code-capsules.md)
* [Nuxt3 and Nitro](nuxt3-and-nitro.md)
* [How to Deploy a React Token dApp to Code Capsules](how-to-deploy-a-react-token-dapp-to-code-capsules.md)
* [Optimizing Performance in MERN Stack: Tips and Techniques](optimizing-performance-in-mern-stack-tips-and-techniques.md)
* [Creating and Hosting an API With Flask](creating-and-hosting-an-api-with-flask/README.md)
* [API Reference \[Sample\]](creating-and-hosting-an-api-with-flask/api-reference-sample.md)
* [Building a Full Stack Application with Flask and HTMx](building-a-full-stack-application-with-flask-and-htmx.md)
* [Create and Host a Telegram Bot with Node.js on Code Capsules](create-and-host-a-telegram-bot-with-node.js-on-code-capsules.md)
* [Build a Slackbot with Node.js to Monitor your Applications](build-a-slackbot-with-node.js-to-monitor-your-applications.md)
* [Video Guides](video-guides.md)
* [Building a Full Stack Application With Express and HTMx](building-a-full-stack-application-with-express-and-htmx.md)
Expand Down
Loading