cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

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
Helper II
Helper II

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!

Highlighted
Helper II
Helper II

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
Community Support

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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (5,035)