디스코드 임베드 이미지 - diseukodeu imbedeu imiji

Hey friends! If you’re reading this then you probably already know that the Send Channel Message action for Discord doesn’t currently have a field for image files to be attached. While you can include links to images in the Message Text field and they’ll usually be displayed, you can’t add embed them so that the image link isn’t shown. Bummer, right? Well, not anymore! Let me show you a neat trick to get around this using my favourite app, Webhooks by Zapier.

To get around having to create a custom integration to handle all the fancy OAuth stuff we’re going to utilise Discord’s built in Webhooks feature. It’s a bit more limited, but is super quick to set up.

Set up the webhook

To set up the webhook in Discord, click the Edit Channel icon next to one of the channel names on your server:

디스코드 임베드 이미지 - diseukodeu imbedeu imiji

Next, you’ll want to click on the Integrations option on the menu. And from there, click on Create Webhook to begin setting up your webhook.

디스코드 임베드 이미지 - diseukodeu imbedeu imiji

With the webhook, we’ll be posting as a bot so enter a NAME for your bot, give it a cool avatar IMAGE and select what CHANNEL it’s going to be posting messages in.

Once you’ve done that, click on the Copy Webhook URL button to add the webhook's URL to your clipboard (We’ll need it in a bit). Oh, and don’t forget to press the Save button to save any changes you make! 

디스코드 임베드 이미지 - diseukodeu imbedeu imiji

For more in-depth instructions check out Discords setup guide for Webhooks here: Intro to Webhooks

In Zapier

Set up your trigger

This part will be specific to your desired workflow but for the purposes for this example I’ve set up the Zap to use a Google Sheets New Spreadsheet Row trigger. This will send the Zap the image link and message that needs to be posted to Discord. For more details on how to set up a trigger step check out this guide: Set up your Zap trigger

Set up your action

Now, let’s get this Webhook step set up! On your action step, select the Webhooks by Zapier app and the Custom Request Action Event:

디스코드 임베드 이미지 - diseukodeu imbedeu imiji

In the next section, for the Method select POST. And for the URL field, we’ll need to paste in that Webhook URL that we copied from Discord previously.

The Data field is where we’ll give the details of the message we want to send to Discord. To do that we need to follow the structure outlined in Discord’s API documentation - See Create Message for example.

Here’s some example code you can use:

{

"content":"Select the message text here",

"username":"Specify a name for the bot",

"avatar_url": "Add a link to a new image for the bot",

"embeds": [{

"image": {

        "url": "Select the image URL"

      }

}]

}


We’re not using all the available parameters since I’m only wanting to post a message with an embedded image. I don’t really need to include the username or avatar_url parameters here either. But I wanted to show that if you wanted to change the username or avatar of the bot that’s posting for example, you could specify those in the Data field and it would overwrite the webhook’s bot settings that we set up in Discord earlier. 

Lastly, in the Headers section you’ll want to set Content-Type as a key (on the left) and set it’s value to be application/json.

In the end you should end up with a set up that looks something like this:

디스코드 임베드 이미지 - diseukodeu imbedeu imiji

Which would post a message to Discord like this:

디스코드 임베드 이미지 - diseukodeu imbedeu imiji

Bonus: Attach other types of files

While playing around I also discovered that there’s a super simple way to post a file as an attachment. All you need to do is specify the Webhook URL (from Discord) in the URL field, leave the Data field blank, then in the File field select your File Object or publicly accessible File URL from the relevant step and you’re done:

디스코드 임베드 이미지 - diseukodeu imbedeu imiji

Just specifying the Webhook URL and file will then all the bot to post the file to Discord like this:
디스코드 임베드 이미지 - diseukodeu imbedeu imiji

Easy right? I should also mention though, that it’s not possible to include a message with the file but you could always use an additional Webhook step to first post the message and follow that up with a secondary webhook step to attach the file. Not super ideal I know but hopefully it’s useful still. 

Wrapping Up

Phew! You can take a break now, we’re all done. I know having to set up webhooks instead of using the existing Send Channel Message action isn’t ideal but hopefully you’ll find this workaround helpful. And please do let me know if you do give this a try. I’d love to hear how you got on in the comments below.

Happy Zapping! 

디스코드 임베드 이미지 - diseukodeu imbedeu imiji