Skip to content

Commit fc1b37e

Browse files
committed
docs
1 parent 8aca0c0 commit fc1b37e

File tree

4 files changed

+477
-3
lines changed

4 files changed

+477
-3
lines changed
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
---
2+
sidebar_position: 8
3+
---
4+
5+
# 🔄 Crosspost Plugin
6+
7+
The Crosspost plugin enables distribution of curated content to [Crosspost](https://crosspost.near), a cross-platform social media posting service built on the NEAR Protocol.
8+
9+
## 🔧 Setup Guide
10+
11+
1. Create a NEAR account if you don't already have one.
12+
13+
:::note
14+
You'll need a NEAR account with sufficient funds to cover transaction fees for posting content to Crosspost.
15+
:::
16+
17+
2. Generate a function call access key (FCAK) for your account using [NEAR CLI](https://github.com/near/near-cli-rs):
18+
19+
```bash
20+
near account add-key YOUR_ACCOUNT_ID grant-function-call-access --allowance '0 NEAR' --contract-account-id crosspost.near --function-names '' autogenerate-new-keypair print-to-terminal network-config mainnet sign-with-keychain send
21+
```
22+
23+
This will print a secret keypair to your terminal. Copy this keypair as it will be used as your `keyPair` in the configuration.
24+
25+
:::tip
26+
Before using Crosspost, you should login to [opencrosspost.com](https://opencrosspost.com) with your NEAR wallet and connect your social media accounts.
27+
:::
28+
29+
3. Modify your `curate.config.json` to include the Crosspost configuration:
30+
31+
```json
32+
{
33+
"outputs": {
34+
"stream": {
35+
"enabled": true,
36+
"distribute": [
37+
{
38+
"plugin": "@curatedotfun/crosspost",
39+
"config": {
40+
"signerId": "account.near",
41+
"keyPair": "{ACCOUNT_PRIVATE_KEY}",
42+
"method": "create"
43+
}
44+
}
45+
]
46+
}
47+
}
48+
}
49+
```
50+
51+
The container is already set up to hydrate environment variables into the configuration at runtime, replacing `{ACCOUNT_PRIVATE_KEY}` with the values from the environment.
52+
53+
You need to specify:
54+
- `signerId`: Your NEAR account ID (e.g., example.near)
55+
- `keyPair`: The private key for your NEAR account
56+
- `method`: The action to perform (see Methods section below)
57+
58+
:::caution
59+
Keep your private key secure! Never commit it directly to your configuration files or repositories.
60+
:::
61+
62+
4. Enable the stream by setting `"enabled": true` if not already enabled.
63+
64+
Once merged, your approved messages will start flowing to Crosspost through your configured account.
65+
66+
:::tip
67+
If your stream had been disabled and you have existing, approved curations, call `/api/feeds/:feedId/process` to process them.
68+
:::
69+
70+
## 📝 Configuration Reference
71+
72+
Full configuration options for the Crosspost plugin:
73+
74+
```json
75+
{
76+
"plugin": "@curatedotfun/crosspost",
77+
"config": {
78+
"signerId": "account.near",
79+
"keyPair": "{ACCOUNT_PRIVATE_KEY}", // Automatically injected from environment
80+
"method": "create" // One of: create, reply, delete, like, unlike, repost, quote
81+
}
82+
}
83+
```
84+
85+
## 🔄 Methods
86+
87+
The Crosspost plugin supports several methods for interacting with the Crosspost platform. The method you choose determines what action will be performed and what input data is required.
88+
89+
| Method | Description | Required Input Schema |
90+
|--------|-------------|----------------------|
91+
| `create` | Create a new post | `CreatePostRequestSchema` |
92+
| `reply` | Reply to an existing post | `ReplyToPostRequestSchema` |
93+
| `delete` | Delete a post | `DeletePostRequestSchema` |
94+
| `like` | Like a post | `LikePostRequestSchema` |
95+
| `unlike` | Unlike a post | `UnlikePostRequestSchema` |
96+
| `repost` | Repost content | `RepostRequestSchema` |
97+
| `quote` | Quote a post with additional text | `QuotePostRequestSchema` |
98+
99+
Each method requires specific input data that conforms to the corresponding schema from the `@crosspost/types` package. For example, when using the `create` method, your input must conform to the `CreatePostRequestSchema`, which typically includes a `text` field for the post content.
100+
101+
### Example Input by Method
102+
103+
#### Create Post
104+
105+
```json
106+
{
107+
"targets": [
108+
{
109+
"platform": "twitter",
110+
"userId": "your-twitter-user-id"
111+
}
112+
],
113+
"content": [
114+
{
115+
"text": "Hello, world! This is a post from Curated.fun."
116+
}
117+
]
118+
}
119+
```
120+
121+
#### Reply to Post
122+
123+
```json
124+
{
125+
"targets": [
126+
{
127+
"platform": "twitter",
128+
"userId": "your-twitter-user-id"
129+
}
130+
],
131+
"platform": "twitter",
132+
"postId": "original-post-id",
133+
"content": [
134+
{
135+
"text": "This is a reply to the original post."
136+
}
137+
]
138+
}
139+
```
140+
141+
#### Delete Post
142+
143+
```json
144+
{
145+
"targets": [
146+
{
147+
"platform": "twitter",
148+
"userId": "your-twitter-user-id"
149+
}
150+
],
151+
"posts": [
152+
{
153+
"platform": "twitter",
154+
"userId": "your-twitter-user-id",
155+
"postId": "post-id-to-delete"
156+
}
157+
]
158+
}
159+
```
160+
161+
#### Like Post
162+
163+
```json
164+
{
165+
"targets": [
166+
{
167+
"platform": "twitter",
168+
"userId": "your-twitter-user-id"
169+
}
170+
],
171+
"platform": "twitter",
172+
"postId": "post-id-to-like"
173+
}
174+
```
175+
176+
#### Unlike Post
177+
178+
```json
179+
{
180+
"targets": [
181+
{
182+
"platform": "twitter",
183+
"userId": "your-twitter-user-id"
184+
}
185+
],
186+
"platform": "twitter",
187+
"postId": "post-id-to-unlike"
188+
}
189+
```
190+
191+
#### Repost
192+
193+
```json
194+
{
195+
"targets": [
196+
{
197+
"platform": "twitter",
198+
"userId": "your-twitter-user-id"
199+
}
200+
],
201+
"platform": "twitter",
202+
"postId": "post-id-to-repost"
203+
}
204+
```
205+
206+
#### Quote Post
207+
208+
```json
209+
{
210+
"targets": [
211+
{
212+
"platform": "twitter",
213+
"userId": "your-twitter-user-id"
214+
}
215+
],
216+
"platform": "twitter",
217+
"postId": "post-id-to-quote",
218+
"content": [
219+
{
220+
"text": "Check out this interesting post!"
221+
}
222+
]
223+
}
224+
```
225+
226+
## 🔐 Security Considerations
227+
228+
- The Crosspost plugin requires a private key to sign transactions. This key should be a function call access key.
229+
- Consider using a dedicated NEAR account for distribution purposes rather than your main account.
230+
- Monitor your account's activity regularly to ensure it's being used as expected.
231+
- Set appropriate gas limits for your transactions to control costs.
232+
233+
## 🔗 Related Resources
234+
235+
- [Crosspost SDK Documentation](https://github.com/open-crosspost/open-crosspost-proxy-service/tree/main/packages/sdk)
236+
- [Crosspost Types Documentation](https://github.com/open-crosspost/open-crosspost-proxy-service/tree/main/packages/types)
237+
- [NEAR Protocol Documentation](https://docs.near.org/)
238+
- [Open Crosspost](https://opencrosspost.com)

0 commit comments

Comments
 (0)