Quick Start (private - alternate flow)
In this quick start guide, we will build a bot server in Python and then integrate it with Poe. Once you have created a Poe bot powered by your server, any Poe user can interact with it. The following diagram might be useful in visualizing how your bot server fits into Poe.
For more information on Poe server bots, check out the Poe Protocol Specification.
Step 1: Project Setup
Make sure you have Python installed. In your terminal, run:
git clone https://github.com/poe-platform/server-bot-quick-start
cd server-bot-quick-start
pip install -r requirements.txt
Inside the server-bot-quick-start
project directory, you will see several different example server bots. For this guide, we will focus on echobot.py
. Open that file in your editor, and we will move onto the next step, Creating a Poe Bot.
Step 2: Creating a Poe Bot
Navigate to the Bot Creation Page on poe.com and select Server bot as the bot type. That should bring you to the following form:
Fill out your bot details, copying down the bot Name and the generated Access Key. You will need these two values in the next step. You can skip filling in Server URL, we will come back to that in Step 3 after deploying our application. Hit Create Bot to finish the bot creation. You will now be brought to a chat page with your bot. You can't talk to it yet, but keep this page open.
Configuring the Access Credentials
Near the bottom of echobot.py
, you should see the following line:
app = fp.make_app(bot, allow_without_key=True)
Change that line to the following (replace <YOUR_ACCESS_KEY>
and <YOUR_BOT_NAME>
with the values you created in the previous step):
app = fp.make_app(bot, access_key=<YOUR_ACCESS_KEY>, bot_name=<YOUR_BOT_NAME>)
Now your bot is configured with the proper credentials! Save the changes to echobot.py
, and we can move onto the next step, Deploying your Bot.
Step 3: Deploying your Bot
We recommend using Modal to deploy your bot, but you can use any deployment method of your choice.
Install the Modal client
Open a terminal and run pip install modal-client
. You might have to use pip3 instead of pip depending on your version of Python.
If you have previously installed modal but run into modal related errors, you might resolve issue by updating the modal package running pip install modal-client --upgrade
Setup your Modal token
This step involves setting up access to modal from your terminal. You only need to do this once for your computer. In the terminal, run modal token new --source poe
. If you run into a "command not found" error, try this.
If that command runs successfully, you will taken to your web browser where you will be asked to log into modal using your Github account.
After you login, click on "create token". You will be prompted to close the browser window after that.
Deploy your bot
From server-bot-quick-start
, run
modal deploy echobot.py
In the terminal output, you should see the URL the bot is deployed at. You will need this URL for next step.
Add the endpoint URL to your Poe Bot
Finally, navigate back to your bot on poe.com. Click on your bot -> triple dots ->
Edit bot:
From here, paste your URL into the Server URL field and save your changes. That's it, you should now be able to talk to your bot!
Iterating on your bot
- For faster iteration on your bot, we recommend using (
modal serve echobot.py
). This is an ephemeral version that is quicker to develop with as it auto restarts on code changes, but the server only lives as long as your terminal stays open. To persistently deploy your bot, you can usemodal deploy echobot.py
instead. - The README provides a brief description of the other example bots included in the repo. Feel free to iterate upon and/or deploy them.
Where to go from here
- One of the advantages of building a bot on Poe is the ability to invoke other Poe bots. In order to learn how to do that check out: accessing-other-bots-on-poe.md.
- Check out other detailed guides that show you how to enable specific features:
- Refer to the specification to understand the full capabilities offered by Poe server bots.
- Check out the fastapi-poe library, which you can use as a base for creating Poe bots.