Slack integration - route to channel based on UserEcho post category

  • updated
  • Completed

I'm trying to route events to Slack channels based on the category of the post or comment in User_echo, such that an uncategorized post can route to #userecho_uncategorized, and when it gets categorized as "Design" the integration will send it to #userecho_design.

Has anyone done something similar?

thomas richardson

Looking forward to learning if anyone out there has done something similar.

Sergey Stukov
  • Under review

Current UserEcho integration can make posts to one Slack Webhook URL which mapped to channel on the Slack side.

For your case we see following solution.

You can setup UserEcho webhook listener on your side, UserEcho will post all updates to it. Like new comment, new post etc.


After notification your listener can repost comment or any other info to required Slack channel  depending on category or any other property of posted event.

thomas richardson
Quote from Sergey Stukov

Current UserEcho integration can make posts to one Slack Webhook URL which mapped to channel on the Slack side.

For your case we see following solution.

You can setup UserEcho webhook listener on your side, UserEcho will post all updates to it. Like new comment, new post etc.


After notification your listener can repost comment or any other info to required Slack channel  depending on category or any other property of posted event.

Thanks Sergey, makes sense, we'll do that.


I'd love to see UserEcho be able to post topic status changes and topic status to the webhook listener too if that's something that can be considered for the future. Cheers!

thomas richardson
Quote from Sergey Stukov

Current UserEcho integration can make posts to one Slack Webhook URL which mapped to channel on the Slack side.

For your case we see following solution.

You can setup UserEcho webhook listener on your side, UserEcho will post all updates to it. Like new comment, new post etc.


After notification your listener can repost comment or any other info to required Slack channel  depending on category or any other property of posted event.

Hi Sergey, still working on this. Built a listener, but the category isn't included in what gets posted by UserEcho. Please advise. Here's an example:

{"hook"=>"topic.created",
"created"=>"2020-01-29T22:46:00.473Z",
"data"=>
{"id"=>166,
"header"=>"test 3",
"description"=>"<p>test 3</p>",
"created"=>"2020-01-29T22:46:00.170Z",
"updated"=>"2020-01-29T22:46:00.170Z",
"comment_count"=>0,
"vote"=>{"total"=>0, "diff"=>0, "positive"=>0, "negative"=>0},
"url"=>"http://~~~/communities/1/topics/166-test-3",
"relative_url"=>"/communities/1/topics/166-test-3",
"type"=>{"id"=>8, "name"=>"Ideas"},
"status"=>{"id"=>1, "name"=>"", "updated"=>"2020-01-29T22:46:00.170Z", "color"=>"999999"},
"author"=>
{"id"=>10,
"name"=>"Thomas Richardson",
"slug"=>"thomas-richardson",
"rating"=>2.53,
"is_staff"=>true,
"last_login"=>"2020-01-29T22:41:39.564Z",
"last_activity"=>"2020-01-29T22:46:00.174Z",
"date_joined"=>"2019-08-12T15:48:17.020Z",
"avatar_url"=>"/s/cache/29/40/2940b4da8a53f79f8b9666a23f903dd7.png",
"language"=>"en",
"is_authenticated"=>true,
"title"=>"PM",
"name_and_title"=>"Thomas Richardson (PM)"},
"assigned_to"=>
{"id"=>"",
"name"=>"Anonymous",
"slug"=>"",
"rating"=>0,
"last_login"=>"",
"last_activity"=>"",
"date_joined"=>"",
"avatar_url"=>"",
"language"=>"en",
"is_authenticated"=>false,
"is_staff"=>false,
"title"=>"",
"name_and_title"=>"Anonymous"},
"forum"=>{"id"=>1, "name"=>"Student Ideas"},
"tags"=>[]}}

thomas richardson
Quote from thomas richardson

Hi Sergey, still working on this. Built a listener, but the category isn't included in what gets posted by UserEcho. Please advise. Here's an example:

{"hook"=>"topic.created",
"created"=>"2020-01-29T22:46:00.473Z",
"data"=>
{"id"=>166,
"header"=>"test 3",
"description"=>"<p>test 3</p>",
"created"=>"2020-01-29T22:46:00.170Z",
"updated"=>"2020-01-29T22:46:00.170Z",
"comment_count"=>0,
"vote"=>{"total"=>0, "diff"=>0, "positive"=>0, "negative"=>0},
"url"=>"http://~~~/communities/1/topics/166-test-3",
"relative_url"=>"/communities/1/topics/166-test-3",
"type"=>{"id"=>8, "name"=>"Ideas"},
"status"=>{"id"=>1, "name"=>"", "updated"=>"2020-01-29T22:46:00.170Z", "color"=>"999999"},
"author"=>
{"id"=>10,
"name"=>"Thomas Richardson",
"slug"=>"thomas-richardson",
"rating"=>2.53,
"is_staff"=>true,
"last_login"=>"2020-01-29T22:41:39.564Z",
"last_activity"=>"2020-01-29T22:46:00.174Z",
"date_joined"=>"2019-08-12T15:48:17.020Z",
"avatar_url"=>"/s/cache/29/40/2940b4da8a53f79f8b9666a23f903dd7.png",
"language"=>"en",
"is_authenticated"=>true,
"title"=>"PM",
"name_and_title"=>"Thomas Richardson (PM)"},
"assigned_to"=>
{"id"=>"",
"name"=>"Anonymous",
"slug"=>"",
"rating"=>0,
"last_login"=>"",
"last_activity"=>"",
"date_joined"=>"",
"avatar_url"=>"",
"language"=>"en",
"is_authenticated"=>false,
"is_staff"=>false,
"title"=>"",
"name_and_title"=>"Anonymous"},
"forum"=>{"id"=>1, "name"=>"Student Ideas"},
"tags"=>[]}}

Looks like category doesn't get included with comments either, which is something we hope for as well.

{"hook"=>"comment.created",
"created"=>"2020-01-29T22:31:56.604Z",
"data"=>
{"id"=>267,
"comment"=>"<p>test reply</p>",
"created"=>"2020-01-29T22:31:56.312Z",
"vote"=>{"total"=>0, "diff"=>0, "positive"=>0, "negative"=>0},
"privacy_mode"=>1,
"status"=>0,
"parent_id"=>nil,
"url"=>"http://~~~/communities/1/topics/163-test-topic#comment-267",
"relative_url"=>"/communities/1/topics/163-test-topic#comment-267",
"author"=>
{"id"=>10,
"name"=>"Thomas Richardson",
"slug"=>"thomas-richardson",
"rating"=>2.53,
"is_staff"=>true,
"last_login"=>"2020-01-29T22:02:47.044Z",
"last_activity"=>"2020-01-29T22:31:56.318Z",
"date_joined"=>"2019-08-12T15:48:17.020Z",
"avatar_url"=>"/s/cache/29/40/2940b4da8a53f79f8b9666a23f903dd7.png",
"language"=>"en",
"is_authenticated"=>true,
"title"=>"PM",
"name_and_title"=>"Thomas Richardson (PM)"},
"topic"=>{"id"=>163, "header"=>"Test topic"},
"forum"=>{"id"=>1, "name"=>"Student Ideas"}}}

Vladimir Mullagaliyev

Hello Thomas,

We just checked the code and we see the category is available in "topic.created" webhook if category was selected when topic created.

Here is an example:

"category": {
    "id": 252, 
    "parent": {
        "id": 168, "name": "Test Parent"
    },
    "name": "Test"
},
thomas richardson
Quote from Vladimir Mullagaliyev

Hello Thomas,

We just checked the code and we see the category is available in "topic.created" webhook if category was selected when topic created.

Here is an example:

"category": {
    "id": 252, 
    "parent": {
        "id": 168, "name": "Test Parent"
    },
    "name": "Test"
},

Thanks Vladimir, this is great news. It just so happens that when we were running the tests I posted above, we were experiencing an issue with categories and topic creation that completely explains this – one of my teammates reported that issue and you guys fixed right away, thank you!

We just ran another test - success!

{"hook"=>"topic.created",
"created"=>"2020-01-31T20:56:14.909Z",
"data"=>
{"id"=>171,
"header"=>"Test idea 6 - Category \"Design\"",
"description"=>"<p>Test idea 6 - Category \"Design\"</p>",
"created"=>"2020-01-31T20:56:14.622Z",
"updated"=>"2020-01-31T20:56:14.622Z",
"comment_count"=>0,
"vote"=>{"total"=>0, "diff"=>0, "positive"=>0, "negative"=>0},
"url"=>"~~~/communities/1/topics/171-test-idea-6-category-design",
"relative_url"=>"/communities/1/topics/171-test-idea-6-category-design",
"type"=>{"id"=>8, "name"=>"Ideas"},
"status"=>{"id"=>1, "name"=>"", "updated"=>"2020-01-31T20:56:14.622Z", "color"=>"999999"},
"author"=>
...

Thank you!

thomas richardson

We've got this up and running great for topic creation, but currently don't get the category attribute with comment hooks. Can the comment hooks be updated such that you also include the category with the topic attribute for the comment hooks? This would allow us to remove some special storage and handling we've had to create as a workaround. Thank you.

Vladimir Mullagaliyev
  • Completed
Quote from thomas richardson

We've got this up and running great for topic creation, but currently don't get the category attribute with comment hooks. Can the comment hooks be updated such that you also include the category with the topic attribute for the comment hooks? This would allow us to remove some special storage and handling we've had to create as a workaround. Thank you.

Hello Thomas,

If you need to get topic's category just make an API call when you receive the webhook.

https://userecho.com/dev/api/reference/

Then you will get all information about topic with no need to save something extra on your side.