cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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.

Highlighted
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
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 228 members 5,392 guests
Please welcome our newest community members: