{"id":28476,"date":"2022-07-28T08:32:10","date_gmt":"2022-07-28T08:32:10","guid":{"rendered":"http:\/\/send-slack-message-after-uploading-an-image-in-next"},"modified":"2025-09-26T13:58:50","modified_gmt":"2025-09-26T20:58:50","slug":"send-slack-message-after-uploading-an-image-in-next","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/","title":{"rendered":"Send Slack Notifications After Media Upload"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><p>We use Slack for all kinds of tasks, like talking to coworkers and interacting with different communities. There are a lot of bots we run into that send alerts or give you other functionality like making polls. The best part is that Slack has an API that we can play with to trigger actions from a number of apps.<\/p>\n<p>In this post, we\u2019re going to build a Next app that sends a slack notification once an image has been uploaded to Cloudinary. We\u2019ll go through how to set up the Slack app for your workspace and we\u2019ll implement the API call inside of our app. By the time you finish this post, you should feel more comfortable working with Next and the Slack API.<\/p>\n<h2>Initial project setup<\/h2>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">$ yarn create next-app --typescript\n<\/code><\/span><\/pre>\n<p>This command will prompt you for a project name. I\u2019ve called this project <code>slack-notifs<\/code>, but feel free to name it whatever you like. We\u2019ll need to install the <a href=\"https:\/\/cloudinary.com\/blog\/guest_post\/npmjs.com\/package\/@slack\/web-apie\">Slack package<\/a>.<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">$ yarn add @slack\/web-api\n<\/code><\/span><\/pre>\n<p>If you don\u2019t already have a free Cloudinary account, <a href=\"https:\/\/cloudinary.com\/users\/register\/free\">sign up for one here<\/a>. In the dashboard, get the <code>cloud name<\/code> for your account and the <code>upload preset<\/code> value from your settings. We\u2019ll use these a bit later to upload the images.<\/p>\n<h2>Setup the Slack app in your Slack workspace<\/h2>\n<p>First, you\u2019ll need to create a Slack app so that you can generate a token for the Next app. Log in to Slack in the browser and create a new app. Make sure you choose the right workspace and name the app <code>Image Upload<\/code>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/mediadevs\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1658875943\/e-603fc55d218a650069f5228b\/c5vjjahn0dlqgfqoevsw.png\" alt=\"new app in Slack API\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1158\"\/><\/p>\n<p>You\u2019ll get redirected to a page with all of the app settings we need to set up to interact with this throughout Next API. Let\u2019s start by enabling <code>Incoming Webhooks<\/code>. This is how we\u2019ll be able to post messages from the Next API. You\u2019ll be taken to another page where you\u2019ll need to add a new webhook to your workspace.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/mediadevs\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1658876122\/e-603fc55d218a650069f5228b\/f6w7u26v6mhcngkhnaq4.png\" alt=\"incoming webhook setup\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1055\"\/><\/p>\n<p>Pay extra attention to the workspace permission screen so that you know you\u2019re posting in the right channel. I have mine set to post to my direct messages to test with. After you choose the channel in your workspace, you\u2019ll be redirected back to the <code>Incoming Webhooks<\/code> page. You should test out that the app is working as you expect by using the example cURL method generated on the page.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/mediadevs\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1658876010\/e-603fc55d218a650069f5228b\/b5erojwcgq7eykqcvdav.png\" alt=\"webhook channel permissions url setup\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1003\"\/><\/p>\n<p>Now you need to go to the <code>OAuth &amp; Permissions<\/code> page in the left sidebar. This is where we set the scopes for the access token we\u2019ll use to post messages to our channel. You\u2019ll need the <code>channels:read<\/code>, <code>chat:write<\/code>, and <code>incoming-webhook<\/code> scopes on the <code>Bot Token Scopes<\/code>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/mediadevs\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1658884634\/e-603fc55d218a650069f5228b\/s9tobnjnnm84nw2dyvyo.png\" alt=\"what the scopes will look like in the Slack dashboard\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"2000\" height=\"1051\"\/><\/p>\n<p>With all of this in place, we can move in the Next app and start writing some code.<\/p>\n<h2>Write the back-end<\/h2>\n<p>Let\u2019s start by creating a <code>.env<\/code> file at the root of the project to hold the credentials we need to use Slack and Cloudinary. The file should look something like this.<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">SLACK_TOKEN=xoxb-your-token\nCLOUDINARY_UPLOAD_PRESET=your-upload-preset\nCLOUDINARY_CLOUD_NAME=your-cloud-name\n<\/code><\/span><\/pre>\n<p>We\u2019re going to take advantage of Next\u2019s built-in API functionality. With those values in place, let\u2019s make some updates to the boilerplate code in the <code>pages &gt; api<\/code> folder of the project. There will be a file in this folder called <code>hello.ts<\/code>. Rename it to <code>notication.ts<\/code> and open it. Delete all of the existing code out of the file and replace it with this:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-comment\">\/\/ notification.ts<\/span>\n<span class=\"hljs-keyword\">import<\/span> type { NextApiRequest, NextApiResponse } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"next\"<\/span>;\n<span class=\"hljs-keyword\">import<\/span> { WebClient, LogLevel } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"@slack\/web-api\"<\/span>;\n\n<span class=\"hljs-keyword\">const<\/span> client = <span class=\"hljs-keyword\">new<\/span> WebClient(process.env.SLACK_TOKEN);\n\ntype MessageData = {\n  <span class=\"hljs-attr\">channelName<\/span>: string;\n  imageName: string;\n  imageUrl: string;\n};\n\n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> <span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">handler<\/span>(<span class=\"hljs-params\">\n  req: NextApiRequest,\n  res: NextApiResponse\n<\/span>) <\/span>{\n  <span class=\"hljs-keyword\">const<\/span> body = req.body;\n\n  <span class=\"hljs-keyword\">await<\/span> publishMessage({\n    ...body,\n    <span class=\"hljs-attr\">channelName<\/span>: <span class=\"hljs-string\">\"zzz_test\"<\/span>,\n  });\n\n  res.send(<span class=\"hljs-string\">\"image uploaded successfully\"<\/span>);\n  res.status(<span class=\"hljs-number\">200<\/span>);\n}\n\n<span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">publishMessage<\/span>(<span class=\"hljs-params\">messageData: MessageData<\/span>) <\/span>{\n  <span class=\"hljs-keyword\">const<\/span> channelId = <span class=\"hljs-keyword\">await<\/span> getChannelId(messageData.channelName);\n\n  <span class=\"hljs-keyword\">try<\/span> {\n    <span class=\"hljs-keyword\">if<\/span> (channelId) {\n      <span class=\"hljs-keyword\">await<\/span> client.chat.postMessage({\n        <span class=\"hljs-attr\">token<\/span>: process.env.SLACK_TOKEN,\n        <span class=\"hljs-attr\">channel<\/span>: channelId,\n        <span class=\"hljs-attr\">text<\/span>: <span class=\"hljs-string\">`The <span class=\"hljs-subst\">${messageData.imageName}<\/span> image upload is ready at <span class=\"hljs-subst\">${messageData.imageUrl}<\/span>`<\/span>,\n      });\n    }\n  } <span class=\"hljs-keyword\">catch<\/span> (error) {\n    <span class=\"hljs-built_in\">console<\/span>.error(error);\n  }\n}\n\n<span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">getChannelId<\/span>(<span class=\"hljs-params\">name: string<\/span>) <\/span>{\n  <span class=\"hljs-keyword\">try<\/span> {\n    <span class=\"hljs-keyword\">const<\/span> result = <span class=\"hljs-keyword\">await<\/span> client.conversations.list({\n      <span class=\"hljs-attr\">token<\/span>: process.env.SLACK_TOKEN,\n    });\n\n    <span class=\"hljs-keyword\">if<\/span> (result.channels) {\n      <span class=\"hljs-keyword\">const<\/span> channel = result.channels.find(<span class=\"hljs-function\">(<span class=\"hljs-params\">channel<\/span>) =&gt;<\/span> {\n        <span class=\"hljs-keyword\">return<\/span> channel.name?.includes(name);\n      });\n\n      <span class=\"hljs-keyword\">return<\/span> channel?.id;\n    }\n  } <span class=\"hljs-keyword\">catch<\/span> (error) {\n    <span class=\"hljs-built_in\">console<\/span>.error(error);\n  }\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Let\u2019s step through this code piece by piece. We start with the imports we\u2019ll need from a couple of packages. Then we instantiate a new instance of the Slack client using our bot token. This <code>client<\/code> is how we\u2019ll execute commands to post to the channel we want via the Slack API. Then we move on to define the type for the <code>MessageData<\/code> we need to send the message to the Slack channel.<\/p>\n<p>Next, we define the <code>handler<\/code> function. This function is required for all endpoints in using Next as the back-end. In this function, we get the body from the request, call a function that will publish a message to Slack with the info we have, and then send a response back to the requester.<\/p>\n<p>The <code>publishMessage<\/code> function first finds the <code>channelId<\/code> based on the channel name we pass in. So the <code>getChannelId<\/code> uses the Slack client to find the channel ID based on the name by looping through all of the channels in your Slack workspace. When it finds a matching channel, it sends that ID back.<\/p>\n<p>Then we take the <code>channelId<\/code> and use it in the Slack client to post a message to that specific channel. The message has the name of the image we uploaded and a Cloudinary link to view it. Everything is wrapped in <code>try-catch<\/code> statements so we <em>should<\/em> catch any errors that pop up along the way.<\/p>\n<p>That finishes up the back-end work! Now let\u2019s move over to the front-end where users will upload those images to trigger the Slack message to be posted.<\/p>\n<h2>Build the front-end to upload images<\/h2>\n<p>The front-end will be pretty bare-bones in terms of the user interface. We\u2019ll have an image upload element and a button on the screen, but the majority of the code will handle the API request logic. We\u2019re going to work in the <code>pages &gt; index.tsx<\/code> file so open that and delete the existing code and replace it with the following:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-keyword\">import<\/span> type { NextPage } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"next\"<\/span>;\n<span class=\"hljs-keyword\">import<\/span> { useState } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"react\"<\/span>;\n<span class=\"hljs-keyword\">import<\/span> styles <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"..\/styles\/Home.module.css\"<\/span>;\n\n<span class=\"hljs-keyword\">const<\/span> Home: NextPage = <span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n  <span class=\"hljs-keyword\">const<\/span> &#91;uploadedImage, setUploadedImage] = useState&lt;any&gt;();\n\n  <span class=\"hljs-keyword\">const<\/span> uploadFn = <span class=\"hljs-keyword\">async<\/span> (e: any) =&gt; {\n    e.preventDefault();\n\n    <span class=\"hljs-keyword\">const<\/span> dataUrl = uploadedImage;\n\n    <span class=\"hljs-keyword\">const<\/span> uploadApi = <span class=\"hljs-string\">`https:\/\/api.cloudinary.com\/v1_1\/<span class=\"hljs-subst\">${process.env.CLOUDINARY_CLOUD_NAME}<\/span>\/image\/upload`<\/span>;\n\n    <span class=\"hljs-keyword\">const<\/span> formData = <span class=\"hljs-keyword\">new<\/span> FormData();\n    formData.append(<span class=\"hljs-string\">\"file\"<\/span>, dataUrl);\n    formData.append(\n      <span class=\"hljs-string\">\"upload_preset\"<\/span>,\n      process.env.CLOUDINARY_UPLOAD_PRESET || <span class=\"hljs-string\">\"\"<\/span>\n    );\n\n    <span class=\"hljs-keyword\">await<\/span> fetch(uploadApi, {\n      <span class=\"hljs-attr\">method<\/span>: <span class=\"hljs-string\">\"POST\"<\/span>,\n      <span class=\"hljs-attr\">body<\/span>: formData,\n    }).then(<span class=\"hljs-keyword\">async<\/span> (res) =&gt; {\n      <span class=\"hljs-keyword\">const<\/span> values = <span class=\"hljs-keyword\">await<\/span> res.json();\n\n      <span class=\"hljs-keyword\">const<\/span> data = {\n        <span class=\"hljs-attr\">name<\/span>: values.original_filename,\n        <span class=\"hljs-attr\">url<\/span>: values.url,\n      };\n\n      <span class=\"hljs-keyword\">await<\/span> fetch(<span class=\"hljs-string\">\"\/api\/notification\"<\/span>, {\n        <span class=\"hljs-attr\">method<\/span>: <span class=\"hljs-string\">\"POST\"<\/span>,\n        <span class=\"hljs-attr\">body<\/span>: <span class=\"hljs-built_in\">JSON<\/span>.stringify(data),\n      });\n    });\n  };\n\n  <span class=\"hljs-keyword\">return<\/span> (\n    <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.container}<\/span>&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">main<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{styles.main}<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">input<\/span>\n          <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"file\"<\/span>\n          <span class=\"hljs-attr\">onChange<\/span>=<span class=\"hljs-string\">{(e)<\/span> =&gt;<\/span> setUploadedImage(e.currentTarget.value)}\n        \/&gt;\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">button<\/span> <span class=\"hljs-attr\">onClick<\/span>=<span class=\"hljs-string\">{uploadFn}<\/span>&gt;<\/span>Upload picture<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">button<\/span>&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">main<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n  );\n};\n\n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> Home;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>There\u2019s a bit going on here so let\u2019s walk through it. As usual, we start by importing the packages we\u2019ll need. We will be keeping some of the styles that were part of the boilerplate code to make things a <em>little<\/em> better. Then we jump right into the <code>Home<\/code> component. We start by declaring the <code>uploadedImage<\/code> state.<\/p>\n<h3>Trigger the Slack message with a successful upload<\/h3>\n<p>Then we get to the big part of this component. The <code>uploadFn<\/code> function is how we\u2019re going to upload an image to Cloudinary, get the image name and Cloudinary link, and make the Slack request that we built on the back-end.<\/p>\n<p>First, we define the <code>dataUrl<\/code> which is where the image data will come from. Then we define the Cloudinary upload endpoint we\u2019ll be using with the credentials we got from the Cloudinary dashboard earlier. Next, we make a new <code>FormData<\/code> object that will be sent in the upload request.<\/p>\n<p>After that, we wait for a response from the Cloudinary endpoint and take that data to use in our <code>notification<\/code> endpoint. This will send the Slack message to the channel we specified.<\/p>\n<p>Finally, at the bottom, you see the two elements that are rendered on the page. There\u2019s a simple <code>&lt;input&gt;<\/code> element so users can upload files and a button they click when they\u2019re ready to send the image to Cloudinary.<\/p>\n<p>We\u2019re done! Start the app locally with <code>yarn dev<\/code> and watch the messages go to your Slack channel.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/mediadevs\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1658889454\/e-603fc55d218a650069f5228b\/zch0gsuguayvmijgyuku.png\" alt=\"the image upload bot sending messages to a channel\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"1348\" height=\"842\"\/><\/p>\n<h2>Finished code<\/h2>\n<p>You can check out all of the code in the <code>slack-notifs<\/code> folder of <a href=\"https:\/\/github.com\/flippedcoder\/media-projects\/tree\/main\/slack-notifs\">this repo<\/a>. You can also check out the app in <a href=\"https:\/\/codesandbox.io\/s\/hardcore-fermat-48frwu\">this Code Sandbox<\/a>.<\/p>\n<\/div>\n\n\n  <div class=\"wp-block-cloudinary-code-sandbox \">\n    <iframe\n      src=\"https:\/\/codesandbox.io\/embed\/hardcore-fermat-48frwu?theme=dark&amp;codemirror=1&amp;highlights=&amp;editorsize=50&amp;fontsize=14&amp;expanddevtools=0&amp;hidedevtools=0&amp;eslint=0&amp;forcerefresh=0&amp;hidenavigation=0&amp;initialpath=%2F&amp;module=&amp;moduleview=0&amp;previewwindow=&amp;view=&amp;runonclick=1\"\n      height=\"500\"\n      style=\"width: 100%;\"\n      title=\"hardcore-fermat-48frwu\"\n      loading=\"lazy\"\n      allow=\"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking\"\n      sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"\n    ><\/iframe>\n  <\/div>\n\n\n<div class=\"wp-block-cloudinary-markdown \"><h2>Conclusion<\/h2>\n<p>Working with third-party APIs comes up in almost every app. Since Slack is a commonly used tool across the tech industry, having some practice working with it and the issues that arise will help sharpen your developer skills and push you to think about implementations from a few angles. Just always make sure to check the documentation!<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":41,"featured_media":28477,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[134,406,246,371],"class_list":["post-28476","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-guest-post","tag-next","tag-react","tag-under-review"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Send Slack Notifications After Media Upload<\/title>\n<meta name=\"description\" content=\"Learn how to send Slack messages via API when images are uploaded.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Send Slack Notifications After Media Upload\" \/>\n<meta property=\"og:description\" content=\"Learn how to send Slack messages via API when images are uploaded.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-28T08:32:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-26T20:58:50+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Send Slack Notifications After Media Upload\",\"datePublished\":\"2022-07-28T08:32:10+00:00\",\"dateModified\":\"2025-09-26T20:58:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/\"},\"wordCount\":6,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA\",\"keywords\":[\"Guest Post\",\"Next\",\"React\",\"Under Review\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2022\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/\",\"url\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/\",\"name\":\"Send Slack Notifications After Media Upload\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA\",\"datePublished\":\"2022-07-28T08:32:10+00:00\",\"dateModified\":\"2025-09-26T20:58:50+00:00\",\"description\":\"Learn how to send Slack messages via API when images are uploaded.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA\",\"width\":5364,\"height\":3576},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Send Slack Notifications After Media Upload\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Send Slack Notifications After Media Upload","description":"Learn how to send Slack messages via API when images are uploaded.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/","og_locale":"en_US","og_type":"article","og_title":"Send Slack Notifications After Media Upload","og_description":"Learn how to send Slack messages via API when images are uploaded.","og_url":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/","og_site_name":"Cloudinary Blog","article_published_time":"2022-07-28T08:32:10+00:00","article_modified_time":"2025-09-26T20:58:50+00:00","twitter_card":"summary_large_image","twitter_image":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/"},"author":{"name":"","@id":""},"headline":"Send Slack Notifications After Media Upload","datePublished":"2022-07-28T08:32:10+00:00","dateModified":"2025-09-26T20:58:50+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/"},"wordCount":6,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA","keywords":["Guest Post","Next","React","Under Review"],"inLanguage":"en-US","copyrightYear":"2022","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/","url":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/","name":"Send Slack Notifications After Media Upload","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA","datePublished":"2022-07-28T08:32:10+00:00","dateModified":"2025-09-26T20:58:50+00:00","description":"Learn how to send Slack messages via API when images are uploaded.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA","width":5364,"height":3576},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/guest_post\/send-slack-message-after-uploading-an-image-in-next\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Send Slack Notifications After Media Upload"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":""}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1681924195\/Web_Assets\/blog\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204\/02ab99df40c986c0e65c45ceb833c4b474d42b6c-5364x3576-1_2847760204.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/28476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=28476"}],"version-history":[{"count":1,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/28476\/revisions"}],"predecessor-version":[{"id":38620,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/28476\/revisions\/38620"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/28477"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=28476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=28476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=28476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}