While taking part in the JH GitLab JIHULAB 101 creator camp, I noticed JH GitLab officially runs a bot that serves people in issues. It got me thinking: tons of places have auto-replying support bots — could I build one on JH GitLab just for fun?
I found that JH GitLab’s official bot wasn’t really up to support-reply standards:

I figured I could build a better one. So this happened:

The Approach
To be clear: this post only covers how to implement a bot on JH GitLab. No NLP or AI — you can plug an existing cloud service in for that, so I’ll skip it.
Is there any event or endpoint for when a user gets @-mentioned? I searched the entire API docs; there’s no dedicated endpoint for it. So I started thinking: how do I find out someone mentioned me?
When someone @-mentions me, an entry shows up in my to-do list — and the to-do list does have an API endpoint: https://jihulab.com/api/v4/todos?state=pending&per_page=100
Then I get the to-do list, which contains the project ID, issue ID, type, and so on. Now I know someone mentioned me, along with the project ID, issue ID, and content. That’s manageable.
Then hit the issue endpoint where the event happened: https://jihulab.com/api/v4/projects/:id/issues/:issue_iid — I can reply to it and read its details.
After replying, mark the to-do as done: https://jihulab.com/api/v4/todos/:id/mark_as_done. Done and dusted.
Steps
- Scan the to-do list:
https://jihulab.com/api/v4/todos?state=pending&per_page=100 - Get issue details:
https://jihulab.com/api/v4/projects/:id/issues/:issue_iid - Run content through NLP: plug in whichever bot API you like
- Reply to the issue:
https://jihulab.com/api/v4/projects/:id/issues/:issue_iid/notes - Mark as done:
https://jihulab.com/api/v4/todos/:id/mark_as_done
Why Bother
Isn’t having your own support bot on JH GitLab just cool?
