TeamSpeak Usergroups Sync

Hello together

I’m currently working on a synchronization service between Discourse and TeamSpeak to sync user groups from Discourse to TeamSpeak 3.

This service is already working and I’m tweaking it at the moment. First-time preparation takes about 20 minutes for you.

Technically seen this is a Node.Js server using a server query library.

https://github.com/SvenC56/discourse-teamspeak-bridge

I’m open to your feedback. :slight_smile:

Readme.MD File

Discourse - TeamSpeak 3 Server Bridge

It Ain’t Much But It’s Honest Work

Build Status

Getting started

This Bridge Server syncs specified user groups from the Discourse Board to the TeamSpeak 3 Server. The server runs a cronjob every 5 minutes to sync both servers. This server is in early dev stage but it is fully working.

On server start the server will create a database file which has to be filled by you. It is a pivot table which contains the Group_ID of Discourse and TeamSpeak3.

Prerequisites

better-sqlite3 has some special installation requirements. I recommend to check out this page.

Installing

1.) Install dependencies:

npm install

2.) Configure Environment Variables
Edit the .env.example file with your data.

3.) Install the Dataexplorer Plugin in Discourse.

4.) Add the following query.

-- [params] 
-- string :custom_field_name 
SELECT
   u.id AS user_id,
   u.username AS username,
   g.id AS group_id,
   ucf.value  AS user_field_value 
FROM
   users u 
   JOIN user_custom_fields ucf 
         ON ucf.user_id = u.id 
   join
      group_users gu 
      ON gu.user_id = u.id 
   join
      GROUPS g 
      ON g.id = gu.group_id 
WHERE  ucf.name = :custom_field_name 
       AND ucf.value <> ''
ORDER BY g.id

5.) Create a custom Field in Discourse for the TeamSpeak UID.

6.) Then you have to know which userfield name you are searching for.
This query will help you:

SELECT * FROM user_custom_fields

Using the Webhook

This Server provides a Post-URL (/webhook?secret=MYSECRET) where you can trigger the synchronisation process. The Secret can be set in the Environment Variables.

Running the tests

At the moment no testing is done. This will be a part of future development.

npm run test

Deployment

npm run build
npm run serve

or

npm run start

API Documentation

WIP: In the development environment, you can access the /explorer route to debug and view all currently available routes.

Built With

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Thank you.

2 Likes

Small Update:

1 Like