cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
kman42
Level: Powered On

Help connecting to slack

I managed to create a connection to slack, but I'm having trouble posting and I haven't found any tutorials on the web. I'm starting with something super simple:

 

Slack.PostMessage("test_channel","test");

 

test_channel is a private channel, if that matters, and I am the only member. It doesn't show any errors in the code, but when I run it and come back, it gives me the following error message:

Slack.PostMessage failed: {"ok":false; "error":"not_authed"}

Do I need to join the channel first? I assumed not since the channel is specified in PostMessage. Do I have to post as myself rather than a bot since it is a private channel?

 

Thanks!

 

3 REPLIES 3
kman42
Level: Powered On

Re: Help connecting to slack

I managed to get the basic functionality after disconnecting and re-adding the connector, but I can't figure out how to pass a PowerApps field as the text. I want to do something like:

 

Slack.PostMessage("test_channel",ThisItem.Comments);

 

But it doesn't seem to like ThisItem. Any suggestions?

 

Thanks!

kman42
Level: Powered On

Re: Help connecting to slack

Sorry for the iterative messages, but there really isn't much info out there on using the Slack connector so maybe some of this will help someone else. I realized I was pulling from the wrong source

, so I can now get the basic message to post. I'm now having trouble with formatting, however. 

 

Slack.PostMessage("test","*Date:* " & DataCardValue15.SelectedDate & "*, Name:* " & LookUp('[DB',person_code=DataCardValue16.Text,name) & " \n " & DataCardValue14.Text);

For some reason, the "*Date:*" gets parsed to bold, but nothing after that does. I thought I could actually do something like "*Date: " & variable & ", Name: " & variable2 & "*" to bold the whole thing, but that doesn't work either.

Community Support Team
Community Support Team

Re: Help connecting to slack

Hi @kman42 

Try this formula:

Slack.PostMessage("test",{ "*Date:* " : DataCardValue15.SelectedDate,
"*Name:* " : LookUp('[DB',person_code=DataCardValue16.Text,name) \n DataCardValue14.Text}
)

Here's doc about  it for your reference:

https://docs.microsoft.com/en-us/connectors/slack/

https://api.slack.com/docs/message-formatting

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,725)