Channel Outgoing Webhooks (deprecated)

NOTE:  Outgoing Webhooks for channels have been deprecated. We recommend using the Bot Participation Handler for the same functionality.

What are webhooks?

Webhooks are HTTP callbacks that provide real-time information from one application to other applications. Webhooks are real time and instant, relaying information as and when an event update occurs.  

Channel Outgoing Webhooks

Channel outgoing webhooks are essential to turn messages in a channel into actionable work items. You can easily connect your channel to an application or simply use the handler to post automatic replies when a user posts a message in a channel. 

Below is a list of attributes passed when the outgoing webhook handler of a channel is executed:

AttributeData TypeDescription
usermapDetails of the user who has triggered the handler by sending a message on the channel
attachmentlistInformation in the attachments being shared in a channel. 
datamapMap containing information about the user mentions and messages sent 
operationstringDetails of the operation performed in the channel. Currently only the operation message is supported. 
Note: This attribute will be useful to trigger the handler based on different channel operations, such as a new participant joining, or a participant leaving the channel. 

Creating a channel outgoing webhook

To create an outgoing webhook for a channel:

  1. Open the channel preview by clicking on the channel info or channel image. 
  2. Click on the Connectors tab in channel preview and click Edit Code. 

Note: 

  • Only channel admins can create and manage webhooks. 
  • You can configure only one webhook for a channel. 
  • Admins of the channel can view if a channel's outgoing webhook has been configured and who has configured.
  • If an alias name (bot name) is not configured, the channel webhook's response will default post as the admin who created the webhook. 

Using a channel's outgoing webhook handler

Upload files shared in a channel directly to a folder in Zoho Docs

A team wants to store all files and attachments shared in chat directly in a folder in a cloud storage platform. In this example, we'll try uploading the file to a separate Zoho Docs folder accessible to all participants in the channel.  




output = Map();
if(attachments)
{
	docsparams = Map();
	att = attachments.get(0);
	docsparams.put("stringPart","true");
	docsparams.put("paramName","filename");
	docsparams.put("content","" + att);
	fileslist = List();
	fileslist.add(docsparams);
	att.setParamName("content");
	fileslist.add(att);
	fileName = Map();
	fileName.put("fid","Give your folder ID");
	response = invokeurl
	[
		url :"https://apidocs.zoho.com/files/v1/upload?fid=Give your folder ID"
		type :POST
		files:fileslist
		connection:"Enter your connection name"
	];
	info response;
	result = response.get("response").toList().get(2).toList();
	info result;
	docid = result.toMap().get("result").toList().get(1).toMap().get("uploaddocid");
	output.put("text","[View in Docs](https://docs.zoho.com/file/" + docid + ")");
}
return output;