A Google Chat bot for IT Tickets on Zoho ServiceDesk Platform at Straive.
It answers questions based on the user's IT tickets.
To use it:
- Add "IT Chat - Straive" to your chat or space. Contact [email protected] if this is not visible to you.
- DM it saying something, e.g. "@IT Chat - Straive Help". It'll share the status of your tickets.
- In the Zoho API Console log in as [email protected] (via email OTP forwarded to [email protected]) and add a client for "Server Based Applications" with:
- Client name: IT Chat LLM App
- Homepage URL: https://itchat.straive.app/
- Redirect URIs: https://itchat.straive.app/token
- Configure the Chat API in Straive-Internal Apps project on Google Cloud Console
- App Name: IT Chat - Straive
- Avatar URL:
https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSCPpb1Hpdia-kMDmeGQOCgxplz2m_EUPbWsw&s
- Description: Check your Service Desk ticket status
- Interactive features: Enable everything
- Connection Settings: App URL
- App URL:
https://itchat.straive.app/googlechat
- App home URL:
https://itchat.straive.app/
- Authentication audience: App URL
- Visibility: Make chat available to specific people and groups in Straive.com (add users)
- Logs: Log errors to Logging
- Log into https://dash.cloudflare.com/ as [email protected]
- Create a worker called
itchat
with a custom domainitchat.straive.app
- Clone this repository
- Run
npm install
- Run
npx wrangler kv namespace create "tokens"
to create a namespace and add the binding towrangler.toml
- Run
npx wrangler secret put <key>
also add them to.dev.vars
asKEY=value
:SDP_CLIENT_ID
: Via Zoho API ConsoleSDP_CLIENT_SECRET
: Via Zoho API ConsoleLLMFOUNDRY_TOKEN
: Via LLM Foundry
- Create a worker called
- Run
npm run deploy
to deploy on Cloudflare - Visit https://itchat.straive.app/token as admin to save the
refresh_token
and initialize the app
When the admin visits /token, they
When they log in, it will redirect them to /token with a ?code=$grant_token
. Store the grant_token.
Using the code, send a request to:
curl -i https://accounts.zoho.com/oauth/v2/token \
-X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "code=$grant_token" \
-d "grant_type=authorization_code" \
-d "client_id=$CLIENT_ID" \
-d "client_secret=$CLIENT_SECRET" \
-d "redirect_uri=https://itchat.straive.app/token"
This returns a JSON object with keys access_token
, refresh_token
.
Store the access_token
and refresh_token
in Cloudflare KV "tokens" namespace.
When the token expires, use the refresh token to get a new access token:
curl https://accounts.zoho.com/oauth/v2/token \
-X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "refresh_token=$refresh_token" \
-d "grant_type=refresh_token" \
-d "client_id=$SDP_CLIENT_ID" \
-d "client_secret=$SDP_CLIENT_SECRET" \
-d "redirect_uri=https://itchat.straive.app/token"
Links:
- Zoho Accounts - Connected Apps to check connected apps.
- Disconnect existing app to generate a new refresh token.
- Zoho API Console to create a client.