Skip to content

Commit

Permalink
feat: update js syntax (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-dixit authored Oct 3, 2024
1 parent 2d870bf commit 0832e4b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ entity.disable_trigger("<tigger_id>") # Disable trigger via ID
<Tab title="Using Javascript Code">
<CodeGroup>
```javascript Enable Trigger using javascript code
Coming soon!
import { Composio } from "composio-core";

const client = new Composio({ apiKey: "<x-api-key>" });
let trigger = await client.triggers.enable({ triggerId });
```
</CodeGroup>
</Tab>
Expand Down Expand Up @@ -121,15 +124,9 @@ listener.listen()
<Tab title="Using Javascript Code">
<CodeGroup>
```Javascript Create a trigger listener
import { LangchainToolSet } from "composio-core"; // or any other toolset

const toolset = new LangchainToolSet({ apiKey: process.env.COMPOSIO_API_KEY }); /
const composio_client = toolset.client

// If not using LangchainToolSet
// import {Composio} from "composio-core";
//const composio_client = new Composio({apiKey: process.env.COMPOSIO_API_KEY});
import { Composio } from "composio-core"; // or any other toolset

const composio_client = new Composio({ apiKey: "<x-api-key>" });

// Subscribe to triggers and perform actions
composio_client.triggers.subscribe((data) => {
Expand All @@ -139,7 +136,7 @@ composio_client.triggers.subscribe((data) => {
</CodeGroup>
</Tab>
<Tab title="Using Webhook">
Coming soon!
You can set webhook url in the dashboard.
</Tab>
</Tabs>

Expand Down
30 changes: 27 additions & 3 deletions docs/patterns/howtos/tool-finding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ composio apps
</CodeGroup>
</Tab>
<Tab title="JS">
Coming soon!
<CodeGroup>
```javascript javascript
import { Composio } from "composio-core";
const composio_client = new Composio({ apiKey: process.env.COMPOSIO_API_KEY });
const apps = await composio_client.apps.list();

console.log(apps);
```
</CodeGroup>
</Tab>
</Tabs>

Expand Down Expand Up @@ -63,7 +71,15 @@ composio connections
</CodeGroup>
</Tab>
<Tab title="JS">
Coming soon!
<CodeGroup>
```javascript javascript
import { Composio } from "composio-core";
const composio_client = new Composio({ apiKey: process.env.COMPOSIO_API_KEY });
const connections = await composio_client.getEntity("<entity_id>").getConnections();

console.log(connections);
```
</CodeGroup>
</Tab>
</Tabs>

Expand Down Expand Up @@ -91,7 +107,15 @@ composio actions --limit 10
</CodeGroup>
</Tab>
<Tab title="JS">
Coming soon!
<CodeGroup>
```javascript javascript
import { Composio } from "composio-core";
const composio_client = new Composio({ apiKey: process.env.COMPOSIO_API_KEY });
const actions = await composio_client.actions.list();

console.log(actions);
```
</CodeGroup>
</Tab>

</Tabs>

0 comments on commit 0832e4b

Please sign in to comment.