Mattermost Peer-to-Peer Forum

Feature Request : Incoming webhook to all teams with team and channel specified in payload?


#1

Hi there,
Great work on this so far! I hope you can help me work out something I’m struggling to understand; I’m confused about the workflow for using webhooks.

I want to be able to have tools that simply send messages to team:x channel:y with a single authorisation code.

Given the number of teams and channels I intend to be working with, I don’t want to have to manually create webhooks for every channel, and then build a dictionary to match these up with the correct team/channel that I want to post to from an outside application. Does that make sense?

Am I approaching this in the wrong way?

Is the correct workflow to use the outside application to request a new webhook dynamically and receive the auth code that can then be used to post to any specified team/channel?

Thanks again,
Patrick.


#2

You will need to create a webhook for each team, but you should be able to post to any channel on the team with the webhook.

There’s instructions on how to override the channel in the Addtional Notes section of our incoming webhook documentation.

You can override the channel specified in the webhook definition by specifying a channel parameter in your payload. For example, you might have a single webhook created for Town Square, but you can use payload={"channel": "off-topic", "text": "Hello, this is some text."} to send a message to the Off-Topic channel using the same webhook URL. If an @ symbol followed by a username is specified, then the message will be sent to that user’s direct message channel


#3

Hi there!
I was testing this, overriding the channel, and I get errors all the time. If I put a channel name, I get error 500 response or if I try to make it with a user @somename (valid user) I also get an error 500 response. Only when the channel property is not included the webhook succeeds. Even putting the same channel as the webhook when created, still fails.
Is there a special format to put the channel name? with some # or some other character?
I’m trying to make a webhook that will send messages and it can vary, sometimes it will send to users, sometimes to channels.
Based on the documentation, this should be possible, but I can’t get it to work.
I’ve tested it from Firefox using developer tools and posting.


#4

If I understand this correctly, the person asking the question is wanting to create an incoming webhook to multiple channels in the team. Is there a way to do this? I have an user that is requesting to do so, however, when setting up the incoming webhook, it only specifies a channel where to put in the webhook. May you please readdress this issue? What can I do to assist the user? Or do I simply have to webhook one by one?