Skip to main content

Get started with chat filter customization

Last updated on February 6, 2025

Overview

The AccelByte Gaming Services (AGS) chat filter can be customized to meet your needs. In this guide, we will show you a simple custom chat filter for AGS.

Prerequisites

  1. Windows 11 WSL2 or Linux Ubuntu 22.04 with the following tools installed:

  2. Access to the AccelByte Gaming Services demo environment.

  3. You have downloaded and set up the extend-helper-cli. Download here.

    • To use this tool, refer to its documentation on GitHub.

Download the app template

Clone the chat filter gRPC plugin app template.

git clone https://github.com/AccelByte/chat-filter-grpc-plugin-server-python.git

Then, follow the Setup, Building and Running sections of the repository README.md. Alternatively, from the app root directory, you can use the following python command:

PYTHONPATH=src python -m src.app
note

Ensure that the server is running locally before moving on to the next section.

Start ngrok and expose the port specified within the app. The following command assumes you have not changed the port in the app:

ngrok tcp localhost:6565

Test your local chat filter app

Next, we will test the app locally by using ngrok to expose the localhost to the internet and use the address for chat filter gRPCurl configuration. Then, we'll use the demo.sh script inside the app to test against the real environment.

Register the gRPC plugin

Copy the forwarding address from ngrok. Here's an example of what it will look like:

<number>.tcp.ngrok.io:<port>

Log in to the AGS Admin Portal and go to the namespace in which you wish to create your gRPC Plugin. On the sidebar, go to Chat > Chat Configurations. Select the Locally hosted (for testing purpose) option and put the ngrok address from above. Then, click Create.

Test using gRPCurl

Testing with gRPCurl is optional, but it will ensure that your proxy is working correctly. Download and install gRPCurl and run the following command to print out the list of grpc services served by the forwarded local app. Use your ngrok tcp forwarding address below.

grpcurl -plaintext <number>.tcp.ngrok.io:<port> list

Sample output:

accelbyte.chat.filter.FilterService
grpc.health.v1.Health
grpc.reflection.v1alpha.ServerReflection

Test using the demo shell script

The demo shell script will register your gRPC server URL to AGS chat, create two test users, and guide you to simulate chat between these two users, triggering the custom chat filter gRPC server. Click here for more detailed steps on how to run the demo shell script.

Create the Extend app

To create the Extend app, go to your AGS Admin Portal and use the namespace in which you wish to create your gRPC plugin. On the left pane, hover over Extend and click Overridable Features. Then, click Create New to create a new Extend app.

navigate to create an extend app

Type in the App Name and the Description (optional). Then, click Create.

click to create new extend app

You will be redirected back to Overridable Features app list page with the newly created app with status of Provisioning in Progress.

new extend app listed pending

Wait until the status says UNDEPLOYED and click the app name in the list to see details page.

extend app details page

note

Please note the Namespace, App Name, and the App Repository URI since we're going to use them in the next section.

Build and push the Extend app image

The extend-helper-cli is required to get temporary docker credentials for uploading your docker image. Use the Namespace and App Name used to create your Extend App in the previous section for the following extend-helper-cli command.

extend-helper-cli dockerlogin --namespace <game namespace> --app <app name> --login
important

Create an OAuth Client with confidential client type with the following permission. Keep the Client ID and Client Secret.

  • ADMIN:NAMESPACE:{namespace}:EXTEND:REPOCREDENTIALS [READ]

If you use extend-helper-cli v0.0.3 or lower, create a user if you don't have any with the following permission. Keep the Username and Password.

  • ADMIN:NAMESPACE:{namespace}:EXTEND:REPOCREDENTIALS [READ]

Go to the extend-helper-cli README for more details.

To directly build and push the app docker image, you can run the provided make script inside the app directory:

make imagex_push IMAGE_TAG=v0.0.1 REPO_URL=<app-repository-url>
note

REPO_URL can be copied from the app details page App Repository URL.

Deploy the Extend app

Back in the AGS Admin Portal, inside the Extend App Details page, click Deploy Latest Image and wait until the deployment is successful.

Test the Extend app

Register the gRPC plugin with the Extend app

Go back to the Admin Portal and update the Chat Configurations. Select the AccelByte hosted option and choose one of the Extend apps. Click Save to finish.

Repeat the steps to test using demo shell script again.

A note on Extend App behavior

important

In the deployment setup, there's a timeout mechanism for the gRPC Extend app managed by Envoy. This timeout occurs when there's no incoming/outgoing data or request, allowing the system to free up resources. By default, the timeout duration is 300s for streamIdleTimeout and 30s for routeTimeout.