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));
Last updated