Developer Documentation
DAR Open Network
  • Overview
  • DAR ID
    • Introduction
    • Client ID Registration
    • Authentication
      • 1. Request DAR ID Identity
      • 2. Exchange Code for Access Token
      • 3. Refresh Access Token
      • 4. Get Access Token Details
      • 5. Get User DAR ID Information
    • Security Best Practices
  • DeAI
    • Multi-Agent Framework
      • Development Guide
      • Agent Options
      • Endpoints Overview
    • aiNFT Framework
      • Overview
      • Chat with an NFT Agent
      • Generate a Story for an NFT Agent
      • Group Chat Between Multiple NFT Agents
    • Game Asset Generator
Powered by GitBook
On this page
  1. DeAI
  2. aiNFT Framework

Chat with an NFT Agent

Enable users to ask their NFT agent questions and receive tailored responses.

Example:

  • User: "What can you do?"

  • Agent: "I can provide insights, share stories, and interact in various ways."

Endpoint:

/agent/${agentId}/chat

Request Format:

  • Method: POST

  • Headers:

    • Content-Type: application/json

  • Body:

    {
      "message": "Your message here"
    }
    

Response Format:

  • Structure:

    {
      "data": {
        "response": "Agent's response"
      }
    }
    

Example Code:

async function chatWithNFTAgent(agentId, message) {
    const response = await fetch(`https://api.example.com/agent/${agentId}/chat`, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ message })
    });

    const data = await response.json();
    return data.data.response;
}

// Usage:
chatWithNFTAgent("agent123", "What special powers do you have?")
    .then(response => console.log(response));
PreviousOverviewNextGenerate a Story for an NFT Agent

Last updated 4 months ago