Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change sender in slack #190

Closed
VasilevMaxim opened this issue Nov 19, 2021 · 7 comments
Closed

Change sender in slack #190

VasilevMaxim opened this issue Nov 19, 2021 · 7 comments

Comments

@VasilevMaxim
Copy link

Hi! Sorry to write about the problem here.
There is the following problem:

There is a teamcity server, the tcwebhooks plugin is installed on it.

When I insert the URL of a web hook from the Incoming Web Hooks section to the server, messages begin to be sent on my behalf, and not on behalf of the bot (TeamCity applications, that is, slack applications).

Can you tell me what I can do to make messages come from the front side of the application, and not from mine? Thanks!
https://wampi.ru/image/RErsi4Z

@netwolfuk
Copy link
Member

netwolfuk commented Nov 19, 2021

Hi @VasilevMaxim
Looking at the screenshot you posted, the event is posted by the TeamCity app.

I'll have a look on the weekend and try to reproduce the problem you decride.

@VasilevMaxim
Copy link
Author

@netwolfuk

I'll describe everything in more detail just in case.

If I change the URL Ebook and select the "TeamCity App" (https://wampi.ru/image/RErXgAa) init application, then the messages really come from the bot application (https://wampi.ru/image/RErX668).

However, I want the boot application to send a message not to me, but to another person (for example, "Артём Богунов").

And if I specify the Webhook URL of a team member "Артём Богунов", then messages are sent on my behalf, not on behalf of the bot (https://wampi.ru/image/RENBwnE )

Only when a team member himself visits this site and gets a Webhook URL for himself, everything starts working as it should. But you can't force every team member to do that.

But how do I do it? How do I identify the person to whom the message should come? Thanks! https://wampi.ru/image/RErXG4I

Thanks!

@netwolfuk
Copy link
Member

netwolfuk commented Nov 19, 2021

Hi @VasilevMaxim I think this is not possible in slack when using a webhook integration. I imagine this is intentional, otherwise any webhook could impersonate any other slack user.

Is there a problem with slack messages coming from the TeamCity App user? I personally think this makes good sense.

It is possible to mention a user by mapping their git username to their slack username. When using this mapping, we can find the usernames of the change commiters and include their name in the message. I have an example somewhere on how to do that.

@netwolfuk
Copy link
Member

Hi @VasilevMaxim I found the example template that uses a jsonMap to define the mappings from git username to slack username.

You can see my post here; #156 (comment)
I'll do some testing and make sure it works correctly.

@VasilevMaxim
Copy link
Author

VasilevMaxim commented Nov 19, 2021

Hi @netwolfuk I may have misunderstood you, but my task is as follows: I need the bot (TeamCity app) to send a message to a team member on its own, just like the Slack notification built into TeamCity does.

So that the message does not come in a dialogue with me, but in a dialogue with the bot. Thanks!

@netwolfuk
Copy link
Member

netwolfuk commented Nov 19, 2021

Thanks @VasilevMaxim for the clarification.

The webhook uses the slack webhook API. I suspect that it would need to use the slack bot API to support your use case.

It might be possible to do a mapping of some kind, but now I understand why you'd need to create an webhook for every user on slack.

I have some experience with the slack bot API from when I wrote the tcChatBot plugin. It is much more powerful than the slack webhook API.

I'll keep thinking about it and see if I can come up with a solution.

@netwolfuk
Copy link
Member

netwolfuk commented Jul 8, 2022

Hi @VasilevMaxim I have not been able to determine how to change the user that the webhook is posted as in slack. Sorry. I will close this topic as it's not something that I can control in tcWebHooks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants