Hi there, I am trying to make pack which can send data to the zoho cliq channel through their api. Now i have got the authentication working and i am able to get the flow working but their access token gets expired after one hour, i am also getting a refresh token but even after that my pack is not fetching the new access token by using refresh token
export const pack = coda.newPack();
import * as coda from "@codahq/packs-sdk";
import { ValueType } from "@codahq/packs-sdk";
// Define the pack to send data to Zoho Cliq
pack.addFormula({
name: "SendMessageToCliq",
description: "Send a message to a Zoho Cliq channel.",
isAction:true,
parameters: [
coda.makeParameter({
name: "message",
description: "The message to send to the Zoho Cliq channel.",
type: coda.ParameterType.String, // Correct parameter type usage
}),
coda.makeParameter({
name: "channel",
description: "The Zoho Cliq channel name or id.",
type: coda.ParameterType.String, // Correct parameter type usage
}),],
execute: async([message, channel],context) => {
const url=`https://cliq.zoho.in/company/{redacted by me}/api/v2/channelsbyname/${channel}/message`;
// Send POST request to Zoho Cliq
try{
const response=await context.fetcher.fetch({
method: "POST",
url: url,
body: JSON.stringify({
text: message
})
});
return "Success";
}
catch(e:any){
if(e.toString().includes("401"))
throw new coda.UserVisibleError(`Unauthorized`)
}
},
resultType: ValueType.String
});
pack.addNetworkDomain("cliq.zoho.in")
pack.setUserAuthentication({
type: coda.AuthenticationType.OAuth2,
postSetup:[],
authorizationUrl: "https://accounts.zoho.in/oauth/v2/auth",
tokenUrl: "https://accounts.zoho.in/oauth/v2/token",
scopes: ["ZohoCliq.Webhooks.CREATE"],
tokenPrefix:"Zoho-oauthtoken",
additionalParams:{
"access_type":"offline",
"prompt":"consent"
}
});
I think its setup correctly but its not fetching new access token. Since this is an automation, i dont want to login after every 1 hour. Need help