Trigger block is similar to the SEND block with one important difference. SEND block will trigger specified events for the same chatbot user (i.e. in the same conversation, happening with the same user), while the TRIGGER block allows you to send events to other users in the chatbot.
This allows you to start certain skills for one user when something is happening in conversation with another user. The most common use case is sending notifications to chatbot admins – on new leads, orders, or customers’ questions. With some creativity, you can also use this to arrange anonymous conversations between different users of the same chatbot – for example, when building a match-making bot.
The example above shows a simple skill that will send new order notifications to two other users in the chatbot (perhaps, shop administrators). When each of the TRIGGER blocks is executed, the “notify_admin” event will be triggered for chatbot users with specified IDs.
To handle these notifications, you should add the “notify_admin” skill to your chatbot. Here is a simple example:
ℹ️ How do I know the ID of the user to use in the TRIGGER block?
Great question! These IDs are assigned dynamically, and even the same person will have different IDs in different chatbots (the IDs are page- and app-specific in Facebook Messenger terminology).
So, if you’re using TRIGGER block to send notifications to chatbot admins, you should first check admin IDs with a simple skill (user ID is available as $_id system attribute):
This skill can be triggered with the “/id” command, and you can hard-code ID values into TRIGGER blocks in your chatbot conversation.
For more info and some TRIGGER block use cases, check our “How to use TRIGGER block for notifications” guide.