with Smartlead and RabbitMQ?
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
smartlead: {
type: "app",
app: "smartlead",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://server.smartlead.ai/api/v1/client`,
params: {
api_key: `${this.smartlead.$auth.api_key}`,
},
})
},
})
import amqp from "amqplib";
export default defineComponent({
props: {
rabbitmq: {
type: "app",
app: "rabbitmq",
}
},
async run({ steps, $ }) {
const url = `amqp://${this.rabbitmq.$auth.username}:${this.rabbitmq.$auth.password}@${this.rabbitmq.$auth.host}:${this.rabbitmq.$auth.port}`;
const connection = await amqp.connect(url);
const channel = await connection.createChannel();
const queue = 'Sample Queue';
await channel.assertQueue(queue, { durable: true });
const message = 'Welcome RabbitMQ + Pipedream users! ' + new Date().toISOString()
channel.sendToQueue(queue, Buffer.from(message), { persistent: true });
console.log(`Sent: ${message}`);
const queueInfo = await channel.checkQueue(queue);
return queueInfo;
},
})