#Trigger creation fails
1 messages · Page 1 of 1 (latest)
@tribal mesa theres a minor bug regarding triggers on our end & team is working on fixing it. I'll update here once the fix is live
also, pls use toolset.triggers.setup({}) is a newer of setting up triggers
Learn more here: https://docs.composio.dev/triggers/using-triggers#managing-triggers. Lmk if you need any help—happy to assist
Yeah, in that documentation the trigger setup is as follows
Which is what i have in my code
Could you help me configure my setUp trigger with the new method (toolset.triggers.setup)?
Sure,
import { ComposioToolSet } from "composio-core"
const toolset = new ComposioToolSet({
apiKey: "<COMPOSIO_API_KEY>"
})
// create a trigger
const res = await toolset.triggers.setup({
connectedAccountId: "2beb...",
triggerName: "SLACK_RECEIVE_MESSAGE",
config: {}
})
console.log(res)
// subscribe to the trigger
const listener = toolset.triggers.subscribe(
(data) => {
console.log(data);
},
{
triggerName: "SLACK_RECEIVE_MESSAGE"
}
)
@tribal mesa It might not work as expected ATM, as we're still fixing the bug, but would work fine soon
@tribal mesa Some triggers require configuration & Gmail's GMAIL_NEW_GMAIL_MESSAGE is one of them—refer the below snippet to get the config which is needed to be passed while setting up the trigger:
const res = await toolset.triggers.getTriggerInfo({ triggerName: "GMAIL_NEW_GMAIL_MESSAGE" })
console.log(res.config)
@tribal mesa I just tried it on my end & its working fine, pls check if you're passing the connectedAccId correctly:
code snip for ref:
const res = await toolset.triggers.setup({
connectedAccountId: "2ab.....",
triggerName: "GMAIL_NEW_GMAIL_MESSAGE",
config: {
interval: 1,
labelIds: "INBOX",
userId: "me"
}
})
console.log(res)
If you're still facing the issue — pls share the request ID (if you're unable to see it set COMPOSIO_LOGGING_LEVEL=debug in your env)