Use {urlsend} to send text to a Slack Channel

Hey, good morning!

Currently I'm using the {urlsend} command to send data to Google Sheets so I can keep track of my work, but I've been thinking if it is possible to use it to send a message with the snippet contents to an specific person or channel in Slack.

Thanks!

1 Like

Hi, and welcome to the forum! :slight_smile:

Slack has an extensive API which you should be able to use to send messages.

You can read more about it here:

1 Like

Thanks for the info! So yeah, I read through it and created the app, got the token needed...

Then checking the {urlsend} command I was able to see it could be used to send the text:

{urlsend: https://slack.com/api/chat.postMessage; method=POST;headers= Authorization = Bearer Token XXXXX, content-type= application/json{"channel": "C03HPG34ZCH", "text": "Hello world"}}

But I'm not sure what the order of the properties should be.

I'm testing the Post method in another website and it is sending the message normally.

Would you know how to properly create the function here in TextBlaze?

1 Like

Hi @Charlie! I’m a Slack user as well and frequently email content directly to specific channels and conversations. Have you tried obtaining the email address for the channel or conversation and using that to get your data where you want it to go in Slack?

Happy to connect with you and explore this further if you’d like!

Happy Blazing!
-Brad

Sure! I'd like to talk about this more.

According to the Slack API, you had to send a GET method to get the ID's of the channels. Which in my case, I got this ID: C03HPG34ZCH

But I'm really new to this, so not sure how to proceed and integrate this with TB.

2 Likes

Hey Charlie,
This is how we use it and it works perfectly and its very simple, you just need to go to the slack app you created, incoming webhooks and create a webhoook that will give you the link
{urlsend: Slack API | Slack method=POST; body={"text": "Hello World"}; headers=Content-Type=application/json}

2 Likes

{urlsend: [LINK] method=POST; body={"text": "Hello World"}; headers=Content-Type=application/json}

and the link is something like: https: // hooks.slack.com/ XXX / XX / XX

2 Likes

Hi @Charlie! Apologies for the delayed response. I was unexpectedly out of touch for a few days. Looking at the suggestion above that @Lidia_RF provided, it seems like a sound solution. Give it a try and let us know how it goes!

Keep Blazing :fire:
-Brad

1 Like