Zoho crm Logo

更新通知详情

目的

更新用户启用的通知详情。所有提供的详情将被保留,其余的详情将被删除。

端点

  • PUT /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"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-X PUT
-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.all",
                "Contacts.create"
            ],
            "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.changed",
            "notify_url": "https://webhook.site/2c9a0f7xxxc20fa9"
        }
    ]
}

示例响应

Copied{
    "watch": [
        {
            "code": "SUCCESS",
            "details": {
                "events": [
                    {
                        "channel_expiry": "2023-08-11T02:04:14-11:00",
                        "resource_uri": "https://www.zohoapis.com/crm/v2/Contacts",
                        "resource_id": "554023000000000129",
                        "resource_name": "Contacts",
                        "channel_id": "10000"
                    },
                    {
                        "channel_expiry": "2023-08-11T02:04:14-11:00",
                        "resource_uri": "https://www.zohoapis.com/crm/v2/Deals",
                        "resource_id": "554023000000000131",
                        "resource_name": "Deals",
                        "channel_id": "10000"
                    }
                ]
            },
            "message": "Successfully subscribed for actions-watch of the given module",
            "status": "success"
        }
    ]
}