Skip to product menu
close
  • Recent Launches
    Press Space or Enter to display list of options
EXPLORE ALL PRODUCTS

Recent Launches

New

Payroll software with automated tax payments and filing.

Try now
New

Robotic process automation software to automate high-volume, rule-based tasks.

Try for free
New

Low-code IoT platform and solutions for connected businesses.

Try now
New

Business formation service to launch and grow your businesses.

Try now
New

Privacy-friendly application analytics solution.

Try for free

Sales

 
CRM

Comprehensive CRM platform for customer-facing teams.

CRM
 
Bigin

Simple CRM for small businesses moving from spreadsheets.

Bigin
 
Forms

Build online forms for every business need.

Forms
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Sign

Digital signature app for businesses.

Sign
 
RouteIQ

Comprehensive sales map visualization and optimal route planning solution.

RouteIQ
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
Suites
CRM Plus

Unified platform to deliver top-notch customer experience.

CRM Plus

Marketing

 
Social

All-in-one social media management software.

Social
 
Campaigns

Create, send, and track targeted email campaigns that drive sales.

Campaigns
 
Forms

Build online forms for every business need.

Forms
 
Survey

Design surveys to reach and interact with your audience.

Survey
 
Sites

Online website builder with extensive customisation options.

Sites
 
PageSense

Website conversion optimization and personalisation platform.

PageSense
 
Backstage

End-to-end event management software.

Backstage
 
Webinar

Webinar platform for webcasting online webinars.

Webinar
 
Marketing Automation

All-in-one marketing automation software.

Marketing Automation
 
LandingPage

Smart landing page builder to increase conversion rates

LandingPage
 
Publish

Manage all your local business listings on a single platform.

Publish
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Sign

Digital signature app for businesses.

Sign
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
LeadChain

Sync, manage, and convert leads across channels seamlessly.

LeadChain
 
NEW
CommunitySpaces

Online community platform for individuals and businesses to grow their network and brand.

CommunitySpaces
 
Suites
Marketing Plus

Unified marketing platform for marketing teams.

Marketing Plus

Commerce and POS

 
Commerce

eCommerce platform to manage and market your online store.

Commerce

Service

 
Desk

Helpdesk software to deliver great customer support.

Desk
 
Assist

Remote support and unattended remote access software.

Assist
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
FSM

End-to-end field service management platform for service businesses.

FSM
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Suites
Service Plus

Unified platform for customer service and support teams.

Service Plus

Finance

 
Books

Powerful accounting platform for growing businesses.

Books
 
FREE
Invoice

100% Free invoicing solution.

Invoice
 
Expense

Effortless expense reporting platform.

Expense
 
Inventory

Powerful stock management and inventory control software.

Inventory
 
Billing

End-to-end billing solution for your business.

Billing
 
Checkout

Collect payments online with custom branded pages.

Checkout
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Practice

Practice management software for accounting firms.

Practice
 
Sign

Digital signature app for businesses.

Sign
 
Commerce

eCommerce platform to manage and market your online store.

Commerce
 
Suites
Finance Plus

All-in-one suite to manage your operations and finances.

Finance Plus

Email and Collaboration

 
Mail

Secure email service for teams of all sizes.

Mail
 
Meeting

Online meeting software for all your video conferencing & webinar needs.

Meeting
 
Writer

Word processor for focused writing and discussions.

Writer
 
Sheet

Spreadsheet software for collaborative teams.

Sheet
 
Show

Create, edit, and share slides with a sleek presentation app.

Show
 
Notebook

Beautiful home for all your notes.

Notebook
 
Cliq

Stay in touch with teams no matter where you are.

Cliq
 
Connect

Employee experience platform to communicate, engage, and build positive employee relations.

Connect
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
TeamInbox

Shared inboxes for teams.

TeamInbox
 
WorkDrive

Online file management for teams.

WorkDrive
 
Sign

Digital signature app for businesses.

Sign
 
Office Suite

Powerful collaborative work platform for teams.

Office Suite
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
Calendar

Online business calendar to manage events and schedule appointments.

Calendar
 
Learn

Knowledge and learning management platform.

Learn
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
ToDo

Collaborative task management for individuals and teams.

ToDo
 
Tables

Work management tool to connect people, processes, and information.

Tables
 
FREE
PDF Editor

Collaborative online PDF editing tool.

PDF Editor
 
Suites
Workplace

Application suite built to improve team productivity and collaboration.

Workplace

Human Resources

 
People

Organize, automate, and simplify your HR processes.

People
 
Recruit

Intuitive recruiting platform built to provide hiring solutions.

Recruit
 
Expense

Effortless expense reporting platform.

Expense
 
Workerly

Manage temporary staffing with an employee scheduling solution.

Workerly
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
Shifts

Employee scheduling and time tracking app.

Shifts
 
Sign

Digital signature app for businesses.

Sign
 
Suites
People Plus

Comprehensive HR platform for seamless employee experiences.

People Plus

Security and IT Management

 
Creator

Build custom apps to simplify business processes.

Creator
 
Directory

Workforce identity and access management solution for cloud businesses.

Directory
 
FREE
OneAuth

Secure multi-factor authenticator (MFA) for all your online accounts.

OneAuth
 
Vault

Online password manager for teams.

Vault
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Toolkit

Complete resource for any admin-related lookup queries.

Toolkit
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
Assist

Remote support and unattended remote access software.

Assist
 
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA

BI and Analytics

 
Analytics

Modern self-service BI and analytics platform.

Analytics
 
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep
 
NEW
IoT

Harnessing IoT analytics for real-time operational intelligence.

IoT

Project Management

 
Projects

Manage, track, and collaborate on projects with teams.

Projects
 
Sprints

Planning and tracking tool for scrum teams.

Sprints
 
BugTracker

Automatic bug tracking software for managing bugs.

BugTracker
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo

Developer Platforms

 
Creator

Build custom apps to simplify business processes.

Creator
 
Flow

Automate business workflows by creating smart integrations.

Flow
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
 
Tables

Work management tool to connect people, processes, and information.

Tables
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
 
NEW
Apptics

Application analytics for all apps.

Apptics
 
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI
 
NEW
IoT

Build, deploy, and scale IoT solutions for connected businesses.

IoT
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep

IoT

 
NEW
IoT

Low-code IoT platform and solutions for connected businesses.

IoT

Search Result

 
CRM Plus

Unified platform to deliver top-notch customer experience.

Try now
CRM Plus
 
Service Plus

Unified platform for customer service and support teams.

Try now
Service Plus
 
Finance Plus

All-in-one suite to manage your operations and finances.

Try now
Finance Plus
 
People Plus

Comprehensive HR platform for seamless employee experiences.

Try now
People Plus
 
Workplace

Application suite built to improve team productivity and collaboration.

Try now
Workplace
 
Marketing Plus

Unified marketing platform for marketing teams.

Try now
Marketing Plus
 
All-in-one suite

Zoho One

The Operating System for Business

Run your entire business on Zoho with our unified cloud software, designed to help you break down silos between departments and increase organizational efficiency.

TRY ZOHO ONE
Zoho One
Zoho Marketplace

With over 2000 ready-to-use extensions across 40+ categories, connect your favorite business tools with the Zoho products you already use.

EXPLORE MARKETPLACE
Marketplace
Skip to main content

Bot Participation Handler

The bot participation handler can be used to add a bot to a channel. The participation handler essentially allows the bot to read, understand and participate in channel conversations. You can configure the bot to do either of the following actions or both, listen and respond to the channel messages and perform a corresponding action or directly send messages in the channel without any prompting. Here're a few examples of how the participation handler can be put to good use. 

  • A help desk bot can be added as a participant in different support channels. The bot can listen to messages, look for support tickets being discussed and can share information about the support ticket right inside the channel. The bot can also take note of the messages and add them as comments to the respective tickets. 
  • How about having a project bot that sends in daily project updates, pulls up task data when there's a discussion going on and simply keeps tabs on the project's progress?

Participation handler attributes

The list of attributes that are passed when the participation handler is triggered is given below. 

AttributeValueDescription
operationString
Expected values: added | removed | message_sent | message_edited | message_deleted | auto_followed_thread | added_in_thread | removed_from_thread | thread_closed | thread_reopened
Denotes the operation performed on the channel. Use this attribute to configure the bot's action based on the operation.
dataMapDetails of the operation performed. The data object will show information based on the operation. 
userMapDetails of the user sending a message in the channel.
chatMapDetails of the channel in which the bot is added as a participant.
environmentMapDetails of the data center to which the user belongs.
accessMapDetails of the user's web client. 

The operation attribute

The operation attribute is of the type, string and denotes the type of operation that is performed in the channel where the bot has been added. You can use this attribute to configure the bot's response based on different operation values. The list of operations for which the bot's participation handler is triggered are: 

Operation TypeDescription
addedWhen the bot has been added to the channel.
removedWhen the bot has been removed from the channel. 
message_sentWhen a new message (text, links, and attachments) is posted by a channel participant.
message_editedWhen a message is edited by a channel participant. 
message_deletedWhen a message is deleted by a channel participant. 
auto_followed_threadWhen a bot (which has auto follow enabled) follows a newly created thread.
added_in_threadWhen a bot is manually added in a thread.
removed_from_threadWhen a bot is removed from the thread by a user.
thread_closedWhen thread is closed.
thread_reopenedWhen thread is reopened.

Note:

  • Along with the above operation the developer can get the current thread details from chat Dre object and the user who performed the action from user object.
  • Message returned via participation handler on thread_closed operation will be skipped.
  • thread_closed and thread_reopened operation will be sent only to the bots currently following the thread.

The data attribute 

The data map can have the following keys based on the operation: 

Associated OperationKeyTypeDescription
added, removed, message_sent, message_edited, message_deletedtimetimestampRepresents the time at which the operation was performed. 
message_sent, message_edited, message_deletedmessageJSON ObjectRepresents the message object. 

Transient Messages

Transient Messages are temporary messages which will only be visible to the participant of a channel who adds or removes a bot from the channel. One can opt to post the message publicly or just close the message. If neither option is selected the message will automatically disappear when you close the channel. 

The bot can be equipped to post temporary messages in a channel whenever its being added to or removed from that particular channel using the bot participation handler.

Example :

The below sample syntax shows different temporary messages being posted when the bot is added to or removed from a channel.



// Sample Syntax for Transient Message

response = Map();
if(operation == "removed")
{
	response.put("type","transient_message");
	response.put("text","Bot removed");
}
else if(operation == "added")
{
	response.put("type","transient_message");
	response.put("text","Bot added");
}
return response;

Configuring the bot's channel participation

A bot's channel participation can be configured from the bot's edit configurations page. You can choose to allow any user to add your bot to any channel. To do so, 

1) In the Create bot page, enable the "Allow users to add this bot to any channel" option.  Once done, there're 2 simple bot participation configurations:

  • Listen to messages - Your bot can listen and respond to messages in the channel
  • Send messages - Your bot can only send messages to the channel without any relative prompting from the user

You can choose either or both options based on the bot's purpose. 

2) Click on Save and head over to the bot's edit handlers page.

3) Click on the Edit Code option provided for the Participation Handler.

4) Add your code and click on save.

How to add a bot to a channel 

To add a bot as a channel participant,

  1. Open the channel where you'd like to add the bot
  2. Then, click on the channel participants info right below the channel heading. 
  3. Click on the Add participants option

4. Search for the bot and then click Add

5. Once you select the bot you'd like to add, a confirmation prompt is displayed with all the actions and permissions the bot can perform in the channel. Click on Add bots to the channel to add the bot as a participant. 

Notes:

  1. Adding a bot to a channel is associated with the channel's permission. Users can add a bot to a channel only if this permission set is enabled for their role. The same permission applies when any user tries to remove a bot from a channel. 
  2. Bots created for personal use (bot access level set as Personal) can also be added to a channel, provided the above-mentioned configuration is enabled. 
  3. You can add a maximum of 10 bots per channel.

Example 

Let's take a sample user scenario to understand how the bot participation handler works. Consider a channel with all your customer support executives to discuss current customer tickets, feedback and more. We'll create a Support Bot, that'll help executives tackle customer requests and tickets in the channel. Whenever a channel participant shares an email in the channel, the bot immediately checks and pulls up any open, ongoing tickets from the respective email ID in Zoho Desk. In case a user wants more details about a specific ticket ID, then the user can ask the bot to bring more information on the specific ticket. This way the bot keeps everyone in the channel informed about the ongoing ticket status. Take a look at the bot's participation handler code given below.

Prerequisites to use this code snippet:


response = Map();
username = user.get("first_name");
if(operation.contains("message_sent"))
{
	info "here";
	text = data.get("message").get("text").toList(" ");
	for each textItem in text
	{
	emailID = textItem.matches("^([\s\S]*)?([\w\-\.\+\'\/]*)@((?!zoho\w).*[\w\-\.]+)(\.[a-zA-Z]{2,22}(\.[a-zA-Z]{2}){0,2})([\s\S]*)?$");
if(emailID)
	{
getTickets = invokeUrl [
    url : "https://desk.zoho.com/api/v1/tickets/search?email="+textItem.trim()
    type : GET
    connection : //Give your connection name
];
info getTickets;
tickets = getTickets.get("data");
rows = List();
for each ticket in tickets
{
row = Map();
row.put("Ticket No",ticket.get("ticketNumber"));
row.put("Subject",ticket.get("subject"));
row.put("Status",ticket.get("statusType"));
rows.add(row);
}
response = {"text":"Here's the list of tickets that "+textItem.trim()+" has raised!","card":{"theme":"modern-inline","title":"Ticket Raised"},"slides":{{"type":"table","title":"","data":{"headers":{"Ticket No","Subject","Status"},"rows":rows}}}};
	}
}
}
return response;

 

The image illustrates how the Support Bot helps customer executives. Whenever a message is posted with an email ID, the Support Bot looks for tickets associated with that email ID in Zoho Desk and posts it directly in the channel.