Post on X with MultiOn

This example combines MultiOn browse and local mode to post a loving message on X.

Project setup

1

Install extension

Find the MultiOn Browser Extension on the Chrome Web Store and click “Add to Chrome” to add it to your browser. Make sure the API Enabled option is checked. Learn more about the browser extension here.

2

Initialize project

Create a new project by running the following command in your terminal:

$npm init
3

Install package

Install the multion package by running the following command in your terminal:

$npm install multion
4

Import library

Create a new file called index.ts and import the required library for the example:

1import { MultiOnClient } from 'multion';
5

Initialize client

Initialize the MultiOn client with your API key.

1const multion = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
6

Run script

Run your script by running the following command in your terminal:

$node index.ts

Follow MultiOn

Use browse in local mode to follow us on X.

1const followResponse = await multion.browse({
2 cmd: "Follow @MultiOn_AI on X",
3 url: "https://x.com",
4 local: true
5});
6
7console.log(followResponse.message);

Hello world!

Continue the same session to say hi to the world.

1const sessionId = followResponse.sessionId
2
3const postResponse = await multion.browse({
4 sessionId: sessionId,
5 cmd: "Post 'Hello world, I love @MultiOn_AI!'"
6});
7
8console.log(postResponse.message);