For ADS Publishers
Get started with setting up the ADS Publisher using the SDK to send events to AI agents in just a few steps.
For n8n users, refer to this.
Prerequisites
Ensure you have the ADS Bridge set up and running.
Environment Setup
Create a .env
file with the required variables:
# Required: RabbitMQ connection details
RABBITMQ_HOST=localhost
RABBITMQ_PORT=5672
RABBITMQ_USERNAME=ads_user
RABBITMQ_PASSWORD=ads_password
Installation
Node.js
npm install @agentdatashuttle/adsjs dotenv
Complete Example
Node.js
import { types, publisher } from "@agentdatashuttle/adsjs";
async function publishSupportTicketExample() {
const clientParams = {
host: process.env.RABBITMQ_HOST || "localhost",
username: process.env.RABBITMQ_USERNAME || "ads_user",
password: process.env.RABBITMQ_PASSWORD || "ads_password",
port: parseInt(process.env.RABBITMQ_PORT) || 5672
};
const adsPublisher = new publisher.ADSPublisher("SupportTicketProcessor", clientParams);
// Support ticket event payload - typically from webhook triggers like Zendesk, Intercom, etc.
const ticketPayload = {
event_name: "new_support_ticket_created",
event_description: "New support ticket has been created by user 'John Doe' in 'Payment related issues' category.",
event_data: {
ticket_id: "TICK-67890",
customer_id: "cust_456",
subject: "Unable to process payment for premium subscription",
description: "Customer experiencing issues with credit card processing during checkout",
priority: "high",
status: "open",
created_at: Date.now(),
customer_email: "[email protected]"
}
};
try {
await adsPublisher.publishEvent(ticketPayload);
console.log(`Support ticket event published successfully for ticket: ${ticketPayload.event_data.ticket_id}`);
} catch (error) {
console.error("Support ticket event publishing failed:", error.message);
}
}
publishSupportTicketExample();
Next Steps
- Provide documentation and help resources about your ADS Publisher for subscribers with details about:
- The configuration for your ADS Bridge
- The events potentially sent by your ADS Publisher that they can make agentic invocations on
- Set up an ADS Subscriber to consume and react to events
Last updated on