#Trigger creation fails

1 messages · Page 1 of 1 (latest)

tribal mesa
#

I am trying to create a trigger for an specific user via the API. As shown in the screenshot, it says that the trigger was successfully created but no trigger is created

placid relic
#

@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

tribal mesa
#

Okay

#

How is the syntax for that new call?

proper moatBOT
tribal mesa
#

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)?

placid relic
#

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
#

It is not working, 400 bad request

#

Could you give me an example for gmail trigger?

placid relic
#

@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 know

#

Thats the configuration properties

#

Hence, my config is

#

But still fails

placid relic
#

@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)