Zoho crm Logo

更新通知的特定信息

目的

仅更新用户启用的特定通知的特定详细信息。所有提供的详细信息将被保留,其余详细信息不会被删除。

端点

  • PATCH /actions/watch

请求详情

请求 URL

{api-domain}/crm/{version}/actions/watch

支持的模块

潜在客户,Account,联系人,交易,活动,任务,案例,会议,电话,解决方案,产品,Vendors,价格表,报价单,Sales Orders,采购Orders,Invoices,预约,重新安排的预约历史,服务和自定义

标题

授权: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

范围

scope=ZohoCRM.notifications.{operation_type}

可能的操作类型

全部 - 完全访问记录
写入 - Edit模块中的记录
更新 - Update模块中的记录

示例请求

Copiedcurl "https://www.zohoapis.com/crm/v6/actions/watch"
-X PATCH
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@inputData.json"

在请求中,"@inputData.json" 包含示例输入数据。

输入 JSON 键

  • token String, optional

    此值在回调中发送回去,以确保通知来自Zoho CRM。最大字符长度为50。
    可能的值: 示例:TOKEN_FOR_VERIFICATION_OF_1000000068001

  • notify_url String, mandatory

    要通知的URL(POST请求)关于模块中发生的操作。
    POSsible值:字符串值。示例:https://www.zoho.com/callback?authorization=Zoho-oauthtoken 1000.23dnsbbbh455jnn&key1=val1&key2=val2

  • channel_id long, mandatory

    给定的值在回调URL主体中返回,以确保通知是针对特定频道的。
    可能的值:频道ID。示例:1000000068001

  • channel_expiry String (ISO Date time), optional

    表示即时通知的 过期时间。该值最多可以设置为启用时间起一周内。如果未指定或设置超过一周,默认的 过期时间为一小时。
    可能的值:ISO 日期时间。示例:2023-02-02T10:30:00+05:30

  • events JSONArray, mandatory

    根据所选模块的特定操作进行订阅。
    可能的值: JSON数组,格式为["{module_api_name}.{operation}", "{module_api_name}.{operation}"]。示例:["Leads.create","Sales_Orders.edit","Contacts.delete","users.all"]。可能的操作类型 - create, delete, edit, all

  • notification_condition JSONArray, optional

    仅当模块的某些字段发生事件时才触发通知。
    此数组包含以下键:

    • type - 字符串,必填 - 表示通知是基于字段更新触发的。值为field_selection。
    • module - JSON对象,必填 - 您希望接收字段事件通知的模块的API名称和ID。
    • field_selection - JSON对象,必填 - 包含最多两个对象,每个对象具有以下键:
      • group_operator - 字符串,必填 - 支持的操作符有and和or。您可以使用这些操作符对字段进行分组。
      • group - JSON数组,必填 - 每个field JSON对象包含模块中字段的API名称和ID。每当这些字段上的任何操作发生时,您将根据其组操作符接收通知。

        注意:无论如何分组,group数组中最多可以有10个字段。

  • notify_on_related_action boolean, optional

    当有任何关联记录的操作时启用通知。默认值为 TRUE。

在URL上获取通知

  • 在模块中触发任何启用通知的事件时,Zoho CRM通过通知URL向用户发送通知。

示例输入

Copied{
    "watch": [
        {
            "channel_id": "10000",
            "events": [
                "Deals.edit"
            ],
            "notification_condition": [
                {
                    "type": "field_selection",
                    "module": {
                        "api_name": "Deals",
                        "id": "554023000000000131"
                    },
                    "field_selection": {
                        "group_operator": "or",
                        "group": [
                            {
                                "field": {
                                    "api_name": "Stage",
                                    "id": "554023000000000525"
                                }
                            
                            },
                            {
                                
                                "group_operator": "and",
                                "group": [
                                    {
                                        "field": {
                                            "api_name": "Account_Name",
                                            "id": "554023000000000523"
                                        }
                                        
                                    },
                                    {
                                        "field": {
                                            "api_name": "Lead_Source",
                                            "id": "554023000000000535"
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                }
            ],
            "channel_expiry": "2023-12-31T09:58:09+05:30",
            "token": "deals.all.notif",
            "notify_url": "https://webhook.site/2c9a0xx20fa9"
        }
    ]
}

示例响应

Copied{
    "watch": [
        {
            "code": "SUCCESS",
            "details": {
                "events": [
                    {
                        "channel_expiry": "2023-08-02T16:59:50-11:00",
                        "resource_uri": "https://www.zohoapis.com.com/crm/v2/Deals",
                        "resource_id": "554023000000000131",
                        "resource_name": "Deals",
                        "channel_id": "10000"
                    }
                ]
            },
            "message": "Successfully updated the subscribe details",
            "status": "success"
        }
    ]
}

响应 JSON 键

  • server integer

    表示通知发送到通知URL时的服务器时间。

  • affected_values JSON array

    表示记录ID和被修改或影响的值。这里,Mobile字段已更新为新值,其记录ID为"5725767000003000010"。

  • query_params JSON object

    表示在通知 URL 中指定的参数(如果有)。

  • resource_uri JSON object

    表示您指定的模块的 URI,当在模块中执行某些操作时,您将收到通知。

  • ids JSON array

    表示受影响记录的唯一ID。

  • affected_fields JSON array

    Returns更新或修改的字段及其对应的值到指定的 notify_url。

  • operation string

    表示在模块上执行的操作。

  • module string

    表示您希望接收任何更改通知的模块名称。

  • channel_id long, mandatory

    给定的值会在回调URL的主体中返回,以确保通知是针对特定频道的。

  • token string

    表示在回调中发送回的值,以确保通知来自Zoho CRM。

通过通知URL接收到的模块中记录更新的示例响应

Copied{
    "server_time": 1718115953625,
    "affected_values": [
        {
            "record_id": "5725767000003000010",
            "values": {
                "Mobile": "123456789"
            }
        }
    ],
    "query_params": {},
    "module": "Leads",
    "resource_uri": "https://www.zohoapis.com/crm/v2/Leads",
    "ids": [
        "5725767000003000010"
    ],
    "affected_fields": [
        {
            "5725767000003000010": [
                "Mobile"
            ]
        }
    ],
    "operation": "update",
    "channel_id": "1000000068001",
    "token": "TOKEN_FOR_VERIFICATION_OF_1000000068001"
}