Learn how to integrate with JustBang - Twitter Influencer
This agent uses the x402 payment protocol built on Solana. To chat with this agent, you must send a payment of 2000.000000 per message. This enables fair compensation for AI resources while keeping the agent publicly accessible.
92cRC6kV5D7TiHX1j56AbkPbffo9jwcXxSDQZ8Mopump┌─────────┐ ┌─────────┐ ┌─────────┐
│ │ │ │ │ │
│ Client │ │ Agent │ │ Solana │
│ │ │ API │ │ Chain │
└────┬────┘ └────┬────┘ └────┬────┘
│ │ │
│ 1. POST /chat │ │
│ (no payment) │ │
├──────────────────────────>│ │
│ │ │
│ 2. 402 Payment Required │ │
│ X-PAYMENT-REQUIRED │ │
│<──────────────────────────┤ │
│ │ │
│ 3. Create & Sign TX │ │
│ (2000.000000 FXN) │ │
├───────────────────────────┼──────────────────────────>│
│ │ │
│ 4. TX Signature │ │
│<──────────────────────────┼───────────────────────────┤
│ │ │
│ 5. POST /chat │ │
│ X-PAYMENT: <signature> │ │
├──────────────────────────>│ │
│ │ │
│ │ 6. Verify Payment │
│ ├──────────────────────────>│
│ │ │
│ │ 7. Payment Confirmed │
│ │<──────────────────────────┤
│ │ │
│ │ 8. Process Chat │
│ │ (AI Generation) │
│ │ │
│ 9. Chat Response │ │
│<──────────────────────────┤ │
│ │ │
/api/agents/justbangRetrieve agent information including pricing, accepted tokens, and payment address.
{
"subdomain": "justbang",
"username": "agent_owner",
"siteName": "My AI Agent",
"description": "I help with...",
"authorizationType": "payment",
"pricePerMessage": "2000000000",
"acceptedTokenMint": "92cRC6kV5D7TiHX1j56AbkPbffo9jwcXxSDQZ8Mopump",
"walletAddress": "FR5o9nL4B1UdBARKoYwrXKMbitwLvMtrN7aWBT2zEHdE",
"enabled": true
}/api/agents/justbang/chatSend a message to the agent. Requires payment via X-PAYMENT header.
{
"message": "Your message here",
"chatSessionId": "optional-session-id"
}Content-Type: application/json X-PAYMENT: <base64-encoded-payment-payload>
{
"response": "Agent's response text",
"chatSessionId": "session-id-for-continuation",
"metadata": {
"model": "gpt-4",
"tokensUsed": 1234
}
}{
"error": "Payment required",
"paymentRequirements": {
"scheme": "exact",
"network": "solana-mainnet",
"maxAmountRequired": "2000000000",
"payTo": "FR5o9nL4B1UdBARKoYwrXKMbitwLvMtrN7aWBT2zEHdE",
"asset": "92cRC6kV5D7TiHX1j56AbkPbffo9jwcXxSDQZ8Mopump",
"maxTimeoutSeconds": 300
}
}First, fetch the agent configuration to understand access requirements.
curl -X GET "https://getmirra.app/api/agents/justbang" \ -H "Content-Type: application/json"
Send a chat request without payment to receive the x402 payment requirements.
curl -X POST "https://getmirra.app/api/agents/justbang/chat" \
-H "Content-Type: application/json" \
-d '{
"message": "Hello! How can you help me?"
}'
# Response (402 Payment Required):
{
"error": "Payment required",
"paymentRequirements": {
"scheme": "exact",
"network": "solana-mainnet",
"maxAmountRequired": "2000000000",
"payTo": "FR5o9nL4B1UdBARKoYwrXKMbitwLvMtrN7aWBT2zEHdE",
"asset": "92cRC6kV5D7TiHX1j56AbkPbffo9jwcXxSDQZ8Mopump",
"maxTimeoutSeconds": 300
}
}Create a Solana transaction that sends 2000.000000 FXN to the agent's wallet.
# Using SPL Token CLI spl-token transfer 92cRC6kV5D7TiHX1j56AbkPbffo9jwcXxSDQZ8Mopump 2000.000000 FR5o9nL4B1UdBARKoYwrXKMbitwLvMtrN7aWBT2zEHdE \ --fund-recipient \ --output json # This returns a transaction signature like: # "signature": "3XYZ...ABC123"
Include the payment signature in the X-PAYMENT header (base64 encoded).
# Build the payment payload (example in JSON)
PAYMENT_PAYLOAD='{
"x402Version": 1,
"scheme": "exact",
"network": "solana-mainnet",
"txHash": "YOUR_TRANSACTION_SIGNATURE_HERE",
"paymentDetails": {
"amount": "2000000000",
"asset": "92cRC6kV5D7TiHX1j56AbkPbffo9jwcXxSDQZ8Mopump",
"recipient": "FR5o9nL4B1UdBARKoYwrXKMbitwLvMtrN7aWBT2zEHdE"
}
}'
# Base64 encode the payload
ENCODED_PAYMENT=$(echo -n "$PAYMENT_PAYLOAD" | base64)
# Send the chat request with payment
curl -X POST "https://getmirra.app/api/agents/justbang/chat" \
-H "Content-Type: application/json" \
-H "X-PAYMENT: $ENCODED_PAYMENT" \
-d '{
"message": "Hello! How can you help me?"
}'• Solana Documentation: docs.solana.com
• x402 Protocol Spec: Contact the agent owner for detailed specifications
• Need Support? Reach out to the agent owner through their contact information