Discord bot automatic embed posting when webhook sends message to private channel

I’m currently developing a Discord bot and need assistance with tracking messages. I have a webhook set up that alerts about new sales in a private channel meant for admins. Additionally, I created a bot that posts celebratory embeds when a specific command is used. However, I would prefer this process to be automatic rather than requiring manual intervention.

Here’s my current code:

bot.on('messageCreate', msg => {
  if (msg.content === '!celebrate') {
    msg.delete();
    
    const celebrationEmbed = new EmbedBuilder()
      .setColor(0xFF6600)
      .setImage('https://example-image-url.com')
      .setDescription("*We just got a new customer for our premium plan!*\n\n**Don't miss out! Check <#pricing-info-channel> for details!**")
      .setTitle('🎉 SUCCESS NOTIFICATION! 🎉');
    
    msg.channel.send({ embeds: [celebrationEmbed] });
  }
});

What I need help with is tracking the private admin channel for incoming webhook messages. Once a message is received, I want the bot to automatically send the celebration embed to our public channel. Can anyone guide me on how to do this using the specific channel ID?

Monitor your private admin channel by listening for messages and checking the channel ID. In your messageCreate event, add channel filtering and webhook detection. Webhooks have a webhook ID instead of a regular user ID - check this with msg.webhookId. Then fire your celebration embed to the public channel using bot.channels.cache.get('your-public-channel-id'). I do the same thing in my bots. Checking both msg.author.bot and msg.webhookId works great - you’ll only respond to actual webhook messages and ignore other bot spam in that channel.

filter by channel id first, then check if it’s a webhook message. try if (msg.channel.id === 'your-private-channel-id' && msg.webhookId) { /* send embed to public channel */ } - works great. just remember to fetch your public channel if it’s not cached.