Skip to main content

Introduction

This guide covers creating and deploying X (Twitter) bots on Shard Cloud.

Creating an X App

1

Access Developer Portal

Go to X Developer Portal and log in.
2

Create Project

Click “Create Project”, choose a name, and select your use case.
3

Create App

Create an app within your project.
4

Generate API Keys

In “Keys and tokens”, generate: - API Key (Consumer Key) - API Secret Key (Consumer Secret) - Access Token - Access Token Secret
5

Set Permissions

Go to “App permissions” and select “Read and write”.
Security: Store all credentials securely. Never commit them to version control.

Creating Your Bot

Setup

Basic Bot Code

index.js

Package.json

package.json

Environment Variables

Set these in the Shard Cloud dashboard:
  • API_KEY: Your X API key
  • API_SECRET_KEY: Your X API secret
  • ACCESS_TOKEN: Your access token
  • ACCESS_TOKEN_SECRET: Your access token secret

Shard Cloud Configuration

.shardcloud

Deploying

1

Prepare Your Files

Ensure you have: - index.js - package.json - .shardcloud
2

Set Environment Variables

Configure all API credentials in the dashboard.
3

Create ZIP Archive

Compress your project folder (excluding node_modules/).
4

Upload to Shard Cloud

Go to Shard Cloud Dashboard and upload.

Additional Resources

Troubleshooting

  • Verify all four credentials are correct - Check that permissions are set to “Read and write” - Regenerate tokens if needed
Implement rate limiting and reduce request frequency.