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

kman42 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.

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (7,347)