Twitter Post

Post to twitter using Multion-API ✨

This example goes over how to use multion API to post to twitter.

Install Required Packages

Ensure you have the necessary packages installed by running the following commands in your terminal:

pip install multion -U

Import Required Libraries

In your Python script, import the required libraries for the example:

import multion

Log in to Multion

See various ways of login here: Login

Create a New Session

Create a new session to initiate the conversation with twitter:

response = multion.create_session({"url": "https://twitter.com"})
session_id = response['session_id']

Update Session

If needed, update the session with additional information:

username = "<your twitte username>"
password = "<your twitter password>"
prompt = "Please post 'Hi from Multi-ON API. ' using username {username} and password as {password}."
url = "https://twitter.com"
while True:
    res = multion.step_session(session_id,{"input":  prompt, "url": url})
    if res['status'] == 'DONE':
        print('task completed')
    # Check the status if done break%

Pro Tip:

You can see the screenshot of each step in response["screenshot"]

Close Session

Finally, close the session when done:


Thank you for exploring this Multion-API example. 😀

  • Should you have any questions, feel free to reach out on our Discord channel or directly to our team. Happy building! 😊