Chat with an NFT Agent
Last updated
Last updated
Enable users to ask their NFT agent questions and receive tailored responses.
User: "What can you do?"
Agent: "I can provide insights, share stories, and interact in various ways."
/agent/${agentId}/chat
Method: POST
Headers:
Content-Type
: application/json
Body:
Structure:
{
"data": {
"response": "Agent's response"
}
}
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));
{
"message": "Your message here"
}