> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Subscription Overview

> DingTalk event subscription is a service offered by the DingTalk Open Platform. It allows developers to receive various important notifications generated by the DingTalk platform in real time within their own apps. By setting up event subscriptions, your app can listen for events that occur in DingTalk, such as departmental structure changes, employee check-ins, and clock-ins, and respond to and process them promptly in your app. With this capability, your enterprise app can integrate more deeply with the DingTalk platform to achieve information sharing

## What Is Event Subscription

DingTalk event subscription is a service offered by the DingTalk Open Platform. It allows developers to receive various important notifications generated by the DingTalk platform in real time within their own apps. By setting up event subscriptions, your app can listen for events that occur in DingTalk, such as departmental structure changes, employee check-ins, and clock-ins, and respond to and process them promptly in your app. With this capability, your enterprise app can integrate more deeply with the DingTalk platform to achieve information sharing and business collaboration.

## **Use Cases**

### Contacts Event Scenarios

When a new employee joins or an employee leaves, your app must update user data immediately. In this case, subscribe to Contacts-related events. Instead of periodically pulling and comparing Contacts data, you receive changed Contacts information in real time and synchronize it.

### Group Event Scenarios

To respond promptly to user actions in a group, subscribe to events. For example, when a user joins a group chat, your app can subscribe to the relevant events under IM Chat Management and send a welcome message to the user when they enter the group chat.

For more events, refer to Event Subscription Overview.

## **Subscription Methods**

|                           | **Stream Mode Push**                                                                                                                                                                                                                                                                                                                                                                                                                                                | **HTTP Push**                                                                                                                                                                                                                     |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Introduction              | Stream mode is an integration method provided by the DingTalk Open Platform. It listens for event subscription callbacks. When you use Stream mode to connect, the DingTalk Open Platform communicates with your app over a WebSocket connection. Stream mode greatly lowers the barrier to integration and reduces resource dependencies. You do not need a public server, IP address, domain, or other resources—simply integrate the DingTalk Open Platform SDK. | HTTP push applies to on-premises deployments. Events are pushed to your business system via encrypted HTTP POST requests.                                                                                                         |
| Applicable Apps           | - Internal app - Third-party enterprise app                                                                                                                                                                                                                                                                                                                                                                                                                         | - Internal app                                                                                                                                                                                                                    |
| Configuration             | [Configure Stream Push (Recommended)](/zh/open/dingstart/configure-stream-push)                                                                                                                                                                                                                                                                                                                                                                                     | [Configure HTTP Push](/zh/open/dingstart/configure-http-push)                                                                                                                                                                     |
| Security                  | No public IP needs to be exposed, so it is protected from attacks. The transport layer uses TLS encryption, and every connection is fully authenticated.                                                                                                                                                                                                                                                                                                            | The data channel is a public channel that incurs traffic costs, has a low Security Level, and offers low efficiency.                                                                                                              |
| Encryption and Decryption | No encryption or decryption is required; you receive the detailed event data directly.                                                                                                                                                                                                                                                                                                                                                                              | The pushed data is encrypted. Developers must verify signatures and perform encryption and decryption themselves, implementing the signature verification, encryption, and decryption logic in their chosen programming language. |

## **Subscription Rules**

DingTalk event subscription lets you subscribe on demand. The specific rules are as follows.

### **Syntax**

Event subscription matching rules use Glob syntax for pattern matching. Glob is a matching method similar to regular expressions, but with more intuitive and simpler syntax. In Glob rules, you can use special characters such as `*`, `?`, `{}`, and `[]` to define patterns. In DingTalk event custom filtering, only the `*` and `{}` characters are used to precisely filter events.

**Note**

If no rules are configured, or all configured rules are deleted, all events of that type are pushed.

* **Single asterisk** `*`

Matches any number of characters, including none. It does not include path boundaries `/` or `\`. For example, `/path/*/abc` matches `/path/a/abc`, `/path/b/abc`, and so on.

* **Double asterisks** `**`

  Similar to a single asterisk, but it can cross path boundaries and is generally used to match multiple levels of directories. For example, `/path/**/abc` can match `/eventkey/a/abc`, `/eventkey/b/abc`, `/eventkey/a/b/abc`, `/eventkey/a/b/c/abc`, and so on.
* **Curly braces** `{}`

  Curly braces specify a set of sub-pattern matches. For example, `{sun,moon,stars}` matches `sun`, `moon`, and `stars`, and `&#123;temp*, tmp*&#125;` matches any string that begins with `temp` or `tmp`.

If you need to subscribe to approval events on demand, refer to the following **Approval Event** examples:

| **Event Type**                                                                                                                                         | **Description**                                                                                               | **Rule Description**                                                                                                                 | **Example**                                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **Approval Task Start/End/Cancel**                                                                                                                     | The start, end, or cancel event of a task for a specific approval template under a business category.         | `/v1.0/event/bpms_task_change/bizCategoryId/&#123;bizCategoryId&#125;/processCode/&#123;processCode&#125;/type/&#123;type&#125;`     | `/v1.0/event/bpms_task_change/bizCategoryId/&#123;bizCategoryId&#125;/processCode/PROC-EA*****F-885E-47AA-AEB9-8F59CB10E309/type/start`     |
| The start, end, or cancel event of a task under a specific approval template, matched directly using the approval template code `processCode`.         | `/v1.0/event/bpms_task_change/processCode/&#123;processCode&#125;/type/&#123;type&#125;`                      | `/v1.0/event/bpms_task_change/processCode/PROC-EA*****F-885E-47AA-AEB9-8F59CB10E309/type/start`                                      |                                                                                                                                             |
| **Approval Instance Start/End/Terminate**                                                                                                              | The start, end, or terminate event of an instance for a specific approval template under a business category. | `/v1.0/event/bpms_instance_change/bizCategoryId/&#123;bizCategoryId&#125;/processCode/&#123;processCode&#125;/type/&#123;type&#125;` | `/v1.0/event/bpms_instance_change/bizCategoryId/&#123;bizCategoryId&#125;/processCode/PROC-EA*****F-885E-47AA-AEB9-8F59CB10E309/type/start` |
| The start, end, or terminate event of an instance under a specific approval template, matched directly using the approval template code `processCode`. | `/v1.0/event/bpms_instance_change/processCode/&#123;processCode&#125;/type/&#123;type&#125;`                  | `/v1.0/event/bpms_instance_change/processCode/PROC-EA*****F-885E-47AA-AEB9-8F59CB10E309/type/start`                                  |                                                                                                                                             |

For related parameter information, refer to Approval Events.

## **Subscription Process**
