# Webhook Usage Instructions

Webhook provides a standardized way for customers to subscribe to certain key nodes in the system and perform corresponding business processing. In the FinClip Management Console, developers can use the Webhook feature to integrate with their own third-party systems (such as SMS or email sending systems) to enhance the user experience.

The event list is as follows:

Event Name Event Code Remarks
SMS EVENT_SMS
Email EVENT_EMAIL
Add Mini-Program EVENT_MINIAPP_ADD
Delete Mini-Program EVENT_MINIAPP_DELETE
Edit Mini-Program EVENT_MINIAPP_EDIT
Publish Mini-Program EVENT_MINIAPP_PUBLISH
Unpublish Mini-Program EVENT_MINIAPP_UNPUBLISH
Rollback Mini-Program EVENT_MINIAPP_ROLLBACK
Disable Mini-Program EVENT_MINIAPP_DISABLE
Enable Mini-Program EVENT_MINIAPP_ENABLE
Enable Mini-Program Search EVENT_MINIAPP_ENABLE_SEARCH
Disable Mini-Program Search EVENT_MINIAPP_DISABLE_SEARCH
Submit Mini-Program Creation Audit EVENT_MINIAPP_SUBMIT_CREATE_AUDIT
Cancel Mini-Program Creation Audit EVENT_MINIAPP_CANCEL_CREATE_AUDIT
Mini-Program Creation Audit Result Notification EVENT_MINIAPP_CREATE_AUDIT_RESULT
Submit Mini-Program Publishing Audit EVENT_MINIAPP_SUBMIT_PUBLISH_AUDIT
Cancel Mini-Program Publishing Audit EVENT_MINIAPP_CANCEL_PUBLISH_AUDIT
Mini-Program Publishing Audit Result Notification EVENT_MINIAPP_PUBLISH_AUDIT_RESULT

# Event Description

# 1. Event - SMS

Note: After selecting the SMS event here, the system's original SMS sending channel will be disabled, and the SMS sending function will be fully handled by the Webhook receiver.

# 1.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) If Token verification is enabled in the management console, it will be transmitted. For specific usage, see the Signature section below.

# 1.2 Request Structure

{
    "event": "EVENT_SMS",
    "params": { // This layer of params will have different values depending on the event.
        "scene": 100, // SMS sending scenario
        "areaCode": "+86", // Country code
        "phone": "18562310708", // Phone number
        "params": [ // This layer of params will have different values depending on the scene.
          // Here, metadata in the form of an object array is provided instead of direct SMS content. This allows for different handling based on different channels.
          // For example, SMS sending platforms like Tencent Cloud maintain templates in the console, and when called, they use templateId.
            {
                "key": "VerifyCode", // Verification code
                "value": "654782"
            },
            {
                "key": "ValidityMinutes", // Number of minutes the verification code is valid, default is 10 minutes
                "value": "10"
            }
        ]
    }
}

# 1.3 Parameter Description

Parameter Type Description
scene Number Currently, only one scenario exists:
100: SMS verification code
areaCode String Country code
phone String Phone number
params object array Different params will be present here depending on the scene.

# 2. Event - Email

Note: After selecting the email event here, the system's original email sending channel will be disabled, and the email sending function will be fully handled by the Webhook receiver.

# 2.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) If Token verification is enabled in the management console, it will be transmitted. For specific usage, see the Signature section below.

# 2.2 Request Structure

{
    "event": "EVENT_EMAIL",
    "params": { // This layer of params will have different values depending on the event.
        "scene": 100, // Email sending scenario
        "to": "test@gmail.com", // Email recipient, currently no mass mailing scenarios are supported
        "subject": "", // Email subject
        "params": [ // This layer of params will have different values depending on the scene.
          // Here, metadata in the form of an object array is provided instead of direct email content. This allows for different handling based on different channels.
          // Some email sending platforms maintain templates in the console, and when called, they use templateId.
            {
                "key": "UserName", // FinClip username
                "value": "autolfymcp"
            },
            {
                "key": "VerifyCode", // Email verification code
                "value": "177793"
            }
        ]
    }
}

# 2.3 Parameter Description

Parameter Type Description
scene Number Currently, only one scenario exists:
100: Email verification code
to String Email recipient
subject String Email subject
params object array Different params will be present here depending on the scene.

# 3. Event - Add Mini-Program

# 3.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) If Token verification is enabled in the management console, it will be transmitted. For specific usage, see the Signature section below.

# 3.2 Request Structure

{
    "event": "EVENT_MINIAPP_ADD",
    "params": {
        "appClassKey": "jinrong1", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1728556977557, // Creation time
        "desc": "Description", // Mini-Program description
        "detailDesc": "Detailed description", // Mini-Program detailed description
        "isForbidden": false, // Whether it is disabled
        "logo": "2367587140282053", // Mini-Program logo ID
        "miniAppId": "fc2398954709929221", // Mini-Program ID
        "name": "Name", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 0, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether it is searchable
        "status": 1, // Status
        "updateTime": 1728556984213 // Update time
    }
}

# 4. Event - Delete Mini-Program

# 4.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) If Token verification is enabled in the management console, it will be transmitted. For specific usage, see the Signature section below.

# 4.2 Request Structure

{
    "event": "EVENT_MINIAPP_DELETE",
    "params": {
        "appClassKey": "jinrong1", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1728556977557, // Creation time
        "desc": "www", // Mini-Program description
        "detailDesc": "wwww", // Mini-Program detailed description
        "isForbidden": false, // Whether it is disabled
        "logo": "2356288317085829", // Mini-Program logo ID
        "miniAppId": "fc2398954709929221", // Mini-Program ID
        "name": "wwww1", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 0, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether it is searchable
        "status": 1, // Status
        "updateTime": 1728557000325 // Update time
    }
}

# 5. Event - Edit Mini-Program

# 5.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) If Token verification is enabled in the management console, it will be transmitted. For specific usage, see the Signature section below.

# 5.2 Request Structure

{
    "event": "EVENT_MINIAPP_EDIT",
    "params": {
        "appClassKey": "jinrong1", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1728556977557, // Creation time
        "desc": "www", // Mini-Program description
        "detailDesc": "wwww", // Mini-Program detailed description
        "isForbidden": false, // Whether it is disabled
        "logo": "2356288317085829", // Mini-Program logo ID
        "miniAppId": "fc2398954709929221", // Mini-Program ID
        "name": "wwww1", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 0, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether it is searchable
        "status": 1, // Status
        "updateTime": 1728557000325 // Update time
    }
}

# 6. Event - Publish Mini-Program

# 6.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) If Token verification is enabled in the management console, it will be transmitted. For specific usage, see the Signature section below.

# 6.2 Request Structure

{
    "event": "EVENT_MINIAPP_PUBLISH",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "autoPub": false, // Whether it is automatically published
        "createTime": 1726642520426, // Creation time
        "desc": "testAppletDescUpdate2", // Mini-Program description
        "detailDesc": "testAppletDetailDescUpdate2", // Mini-Program detailed description
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppCompiledPackageId": "2367587980306374", // Mini-Program compiled package ID
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "miniAppVersionId": "2367588244187077", // Mini-Program version ID
        "name": "autobplgnf2", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "sequence": 23, // Sequence number
        "status": 6, // Status
        "updateTime": 1728557033406, // Update time
        "version": "1.0.19", // Version number
        "versionDescription": "Version description", // Version description
        "sourceFile": [
            {
                "encryptPackages": [
                    {
                        "fileMd5": "e90675c8ee6e1f412bc1054216f8c532",
                        "fileUrl": "/api/v1/mop/runtime/download/2382893072221061", // Encrypted package - subpackage - zip format compressed package
                        "filename": "__APP__.zip",
                        "ftpkgSha256": "982d68bdde0ae3436d804184bddc7a57c8e5dd4a1d71b368febd06d50aa9814b",
                        "ftpkgUrl": "/api/v1/mop/runtime/download/2382893072237445", // Encrypted package - subpackage - ftpkg format compressed package
                        "independent": false,
                        "name": "__APP__",
                        "pages": null,
                        "root": "."
                    }
                ],
                "encryptedFileMd5": "e90675c8ee6e1f412bc1054216f8c532",
                "encryptedUrl": "/api/v1/mop/runtime/download/2382893072221061", // Encrypted package - full package - zip format compressed package
                "fileMd5": "e90675c8ee6e1f412bc1054216f8c532",
                "ftpkgSha256": "982d68bdde0ae3436d804184bddc7a57c8e5dd4a1d71b368febd06d50aa9814b",
                "ftpkgUrl": "/api/v1/mop/runtime/download/2382893072237445", // Encrypted package - full package - ftpkg format compressed package
                "name": "app.zip",
                "packageConfig": {
                    "compatibleMode": false
                },
                "packages": [
                    {
                        "fileMd5": "e90675c8ee6e1f412bc1054216f8c532",
                        "fileUrl": "/api/v1/mop/runtime/download/2382893072221061",
                        "filename": "__APP__.zip",
                        "ftpkgSha256": "982d68bdde0ae3436d804184bddc7a57c8e5dd4a1d71b368febd06d50aa9814b",
                        "ftpkgUrl": "/api/v1/mop/runtime/download/2382893072237445",
                        "independent": false,
                        "name": "__APP__",
                        "pages": null,
                        "root": "."
                    }
                ],
                "uploadDate": 1727576653087,
                "url": "/api/v1/mop/runtime/download/2382893072221061"
            }
        ],
    }
}

# 6.3 Parameter Description

Parameter Type Description
autoPub Boolean Whether to automatically publish
miniAppCompiledPackageId String Mini-Program compiled package ID
miniAppVersionId String Mini-Program version ID
sequence Number Sequence number
version String Version number
versionDescription String Version description

# 7. Event - Unpublish Mini-Program

# 7.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Passed if Token verification is enabled in the management console. Refer to the Signature section below for details.

# 7.2 Request Structure

{
    "event": "EVENT_MINIAPP_UNPUBLISH",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "autoPub": false, // Whether to automatically publish
        "createTime": 1726642520426, // Creation time
        "desc": "testAppletDescUpdate2", // Mini-Program description
        "detailDesc": "testAppletDetailDescUpdate2", // Mini-Program detailed description
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppCompiledPackageId": "2367587980306374", // Mini-Program compiled package ID
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "miniAppVersionId": "2367588244187077", // Mini-Program version ID
        "name": "autobplgnf2", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "sequence": 23, // Sequence number
        "status": 6, // Status
        "updateTime": 1728557033406, // Update time
        "version": "1.0.19", // Version number
        "versionDescription": "Version description", // Version description
        "sourceFile": [
            {
                "encryptPackages": [
                    {
                        "fileMd5": "e90675c8ee6e1f412bc1054216f8c532",
                        "fileUrl": "/api/v1/mop/runtime/download/2382893072221061", // Encrypted package - subpackage - zip format compressed file
                        "filename": "__APP__.zip",
                        "ftpkgSha256": "982d68bdde0ae3436d804184bddc7a57c8e5dd4a1d71b368febd06d50aa9814b",
                        "ftpkgUrl": "/api/v1/mop/runtime/download/2382893072237445", // Encrypted package - subpackage - ftpkg format compressed file
                        "independent": false,
                        "name": "__APP__",
                        "pages": null,
                        "root": "."
                    }
                ],
                "encryptedFileMd5": "e90675c8ee6e1f412bc1054216f8c532",
                "encryptedUrl": "/api/v1/mop/runtime/download/2382893072221061", // Encrypted package - full package - zip format compressed file
                "fileMd5": "e90675c8ee6e1f412bc1054216f8c532",
                "ftpkgSha256": "982d68bdde0ae3436d804184bddc7a57c8e5dd4a1d71b368febd06d50aa9814b",
                "ftpkgUrl": "/api/v1/mop/runtime/download/2382893072237445", // Encrypted package - full package - ftpkg format compressed file
                "name": "app.zip",
                "packageConfig": {
                    "compatibleMode": false
                },
                "packages": [
                    {
                        "fileMd5": "e90675c8ee6e1f412bc1054216f8c532",
                        "fileUrl": "/api/v1/mop/runtime/download/2382893072221061",
                        "filename": "__APP__.zip",
                        "ftpkgSha256": "982d68bdde0ae3436d804184bddc7a57c8e5dd4a1d71b368febd06d50aa9814b",
                        "ftpkgUrl": "/api/v1/mop/runtime/download/2382893072237445",
                        "independent": false,
                        "name": "__APP__",
                        "pages": null,
                        "root": "."
                    }
                ],
                "uploadDate": 1727576653087,
                "url": "/api/v1/mop/runtime/download/2382893072221061"
            }
        ],
    }
}

# 8. Event - Rollback Mini-Program

# 8.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Passed if Token verification is enabled in the management console. Refer to the Signature section below for details.

# 8.2 Request Structure

{
    "event": "EVENT_MINIAPP_ROLLBACK",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "autoPub": true, // Whether to automatically publish
        "createTime": 1726642519646, // Creation time
        "desc": "testAppletDescUpdate2", // Mini-Program description
        "detailDesc": "testAppletDetailDescUpdate2", // Mini-Program detailed description
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppCompiledPackageId": "2367588230064070", // Mini-Program compiled package ID
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "miniAppVersionId": "2367588231210949", // Mini-Program version ID
        "name": "autobplgnf2", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "sequence": 22, // Sequence number
        "status": 6, // Status
        "updateTime": 1728557039793, // Update time
        "version": "1.0.22", // Version number
        "versionDescription": "1.0.22" // Version description
    }
}

# 9. Event - Disable Mini-Program

# 9.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Passed if Token verification is enabled in the management console. Refer to the Signature section below for details.

# 9.2 Request Structure

{
    "event": "EVENT_MINIAPP_DISABLE",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1726642456734, // Creation time
        "desc": "testAppletDescUpdate2", // Mini-Program description
        "detailDesc": "testAppletDetailDescUpdate2", // Mini-Program detailed description
        "isForbidden": true, // Whether disabled
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "name": "autobplgnf2", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 1, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether searchable
        "status": 7, // Status
        "updateTime": 1728557044812 // Update time
    }
}

# 10. Event - Enable Mini-Program

# 10.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Passed if Token verification is enabled in the management console. Refer to the Signature section below for details.

# 10.2 Request Structure

{
    "event": "EVENT_MINIAPP_ENABLE",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1726642456734, // Creation time
        "desc": "testAppletDescUpdate2", // Mini-Program description
        "detailDesc": "testAppletDetailDescUpdate2", // Mini-Program detailed description
        "isForbidden": false, // Whether disabled
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "name": "autobplgnf2", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 1, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether searchable
        "status": 7, // Status
        "updateTime": 1728557044812 // Update time
    }
}

# 11.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Passed if Token verification is enabled in the management console. Refer to the Signature section below for details.

# 11.2 Request Structure

{
    "event": "EVENT_MINIAPP_ENABLE_SEARCH",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1726642456734, // Creation time
        "desc": "testAppletDescUpdate2", // Mini-Program description
        "detailDesc": "testAppletDetailDescUpdate2", // Mini-Program detailed description
        "isForbidden": false, // Whether disabled
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "name": "autobplgnf2", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 1, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether searchable
        "status": 7, // Status
        "updateTime": 1728557073899 // Update time
    }
}

# 12.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Passed if Token verification is enabled in the management console. Refer to the Signature section below for details.

# 12.2 Request Structure

{
    "event": "EVENT_MINIAPP_DISABLE_SEARCH",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1726642456734, // Creation time
        "desc": "testAppletDescUpdate2", // Mini-Program description
        "detailDesc": "testAppletDetailDescUpdate2", // Mini-Program detailed description
        "isForbidden": false, // Whether disabled
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "name": "autobplgnf2", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 1, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": false, // Whether searchable
        "status": 7, // Status
        "updateTime": 1728557070073 // Update time
    }
}

# 13. Event - Submit Mini-Program Creation for Review

# 13.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Will be sent if Token verification is enabled in the Management Console. See the Signature section below for details.

# 13.2 Request Structure

{
    "event": "EVENT_MINIAPP_SUBMIT_CREATE_AUDIT",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1726642456734, // Creation time
        "desc": "testAppletDesc", // Mini-Program description
        "detailDesc": "testAppletDetailDesc", // Mini-Program detailed description
        "isForbidden": false, // Whether it is disabled
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "name": "testApplet", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 1, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether it is searchable
        "status": 2, // Status (2 indicates under review)
        "updateTime": 1728557080123 // Update time
    }
}

# 14. Event - Cancel Mini-Program Creation Review

# 14.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Will be sent if Token verification is enabled in the Management Console. See the Signature section below for details.

# 14.2 Request Structure

{
    "event": "EVENT_MINIAPP_CANCEL_CREATE_AUDIT",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1726642456734, // Creation time
        "desc": "testAppletDesc", // Mini-Program description
        "detailDesc": "testAppletDetailDesc", // Mini-Program detailed description
        "isForbidden": false, // Whether it is disabled
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "name": "testApplet", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 1, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether it is searchable
        "status": 1, // Status (1 indicates canceled)
        "updateTime": 1728557085456 // Update time
    }
}

# 15. Event - Mini-Program Creation Review Result Notification

# 15.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Will be sent if Token verification is enabled in the Management Console. See the Signature section below for details.

# 15.2 Request Structure

{
    "event": "EVENT_MINIAPP_CREATE_AUDIT_RESULT",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "auditApproved": true, // Review result: true - approved, false - rejected
        "createBy": "2367587140282053", // Creator
        "createTime": 1726642456734, // Creation time
        "desc": "testAppletDesc", // Mini-Program description
        "detailDesc": "testAppletDetailDesc", // Mini-Program detailed description
        "isForbidden": false, // Whether it is disabled
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "name": "testApplet", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 1, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether it is searchable
        "status": 3, // Status (3 indicates approved)
        "updateTime": 1728557090789 // Update time
    }
}

# 16. Event - Submit Mini-Program Publishing for Review

# 16.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Will be sent if Token verification is enabled in the Management Console. See the Signature section below for details.

# 16.2 Request Structure

{
    "event": "EVENT_MINIAPP_SUBMIT_PUBLISH_AUDIT",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1726642456734, // Creation time
        "desc": "testAppletDesc", // Mini-Program description
        "detailDesc": "testAppletDetailDesc", // Mini-Program detailed description
        "isForbidden": false, // Whether it is disabled
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "name": "testApplet", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 1, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether it is searchable
        "status": 5, // Status (5 indicates under publishing review)
        "updateTime": 1728557095123, // Update time
        "version": "1.0.1", // Version number
        "versionDescription": "Version description" // Version description
    }
}

# 17. Event - Cancel Mini-Program Publishing Review

# 17.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Will be sent if Token verification is enabled in the Management Console. See the Signature section below for details.

# 17.2 Request Structure

{
    "event": "EVENT_MINIAPP_CANCEL_PUBLISH_AUDIT",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "createBy": "2367587140282053", // Creator
        "createTime": 1726642456734, // Creation time
        "desc": "testAppletDesc", // Mini-Program description
        "detailDesc": "testAppletDetailDesc", // Mini-Program detailed description
        "isForbidden": false, // Whether it is disabled
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "name": "testApplet", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 1, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether it is searchable
        "status": 4, // Status (4 indicates canceled publishing review)
        "updateTime": 1728557100456, // Update time
        "version": "1.0.1", // Version number
        "versionDescription": "Version description" // Version description
    }
}

# 18. Event - Mini-Program Publishing Review Result Notification

# 18.1 Request Headers

Header Description
X-Fc-Webhook-Sign (Optional) Will be sent if Token verification is enabled in the Management Console. See the Signature section below for details.

# 18.2 Request Structure

{
    "event": "EVENT_MINIAPP_PUBLISH_AUDIT_RESULT",
    "params": {
        "appClassKey": "qita", // Mini-Program category key
        "auditApproved": true, // Review result: true - approved, false - rejected
        "createBy": "2367587140282053", // Creator
        "createTime": 1726642456734, // Creation time
        "desc": "testAppletDesc", // Mini-Program description
        "detailDesc": "testAppletDetailDesc", // Mini-Program detailed description
        "isForbidden": false, // Whether it is disabled
        "logo": "https://www-cdn.finclip.com/images/ic-default.png", // Mini-Program logo
        "miniAppId": "fc2367587200788357", // Mini-Program ID
        "miniAppVersionId": "2367588244187077", // Mini-Program version ID
        "name": "testApplet", // Mini-Program name
        "organId": "2367587140839109", // Organization ID
        "privacySettingType": 1, // Privacy setting type
        "projectType": 1, // Project type
        "searchable": true, // Whether it is searchable
        "status": 6, // Status (6 indicates published)
        "updateTime": 1728557105789, // Update time
        "version": "1.0.1", // Version number
        "versionDescription": "Version description" // Version description
    }
}

# Signature

To ensure that your service (the webhook event receiver) has a way to verify that the request comes from a trusted caller, a signature mechanism is provided. To use this feature, you need to:

  1. Check the option to generate a Token when configuring the Webhook.
  2. Save the generated Token. Note: This Token will only be displayed once. Keep it safe; if lost, it can only be reset.
  3. Verify on the Webhook receiver side: The value of Token + request body payload must equal the value of X-Fc-Webhook-Sign in the header.
    • If the option to generate a Token is not checked when configuring the Webhook, the X-Fc-Webhook-Sign header will not be sent.

# Signature Method Explanation

The X-Fc-Webhook-Sign signature uses an HMAC hexadecimal digest of the request body, generated using the SHA-256 hash function, with the webhookToken as the HMAC key.

When verifying the webhook payload, keep the following important points in mind:

  • FinClip uses an HMAC hexadecimal digest to compute the hash value.
  • The hash signature always starts with sha256=.
  • The hash signature is generated using your webhook's webhookToken and webhook request body content.
  • If your language and server implementation specify character encoding, ensure that the payload is processed as UTF-8. Webhook payloads may contain Unicode characters.

# Signature Example

# Java

You can define the following verifySignature method and call it when receiving a webhook request:

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public class WebhookVerifier {
    /**
     * Verify webhook signature
     * 
     * @param payload The request body of the webhook
     * @param webhookToken The generated webhookToken
     * @param signature The X-Fc-Webhook-Sign in the webhook request header
     * @return Whether the signature is valid
     */
    public static boolean verifySignature(String payload, String webhookToken, String signature) {
        String expectedSignature = computeSign(payload, webhookToken);
        return signature.equals(expectedSignature);
    }

    /**
     * Compute signature
     * 
     * @param payload The request body of the webhook
     * @param webhookToken The generated webhookToken
     * @return The signature
     */
    public static String computeSign(String payload, String webhookToken) {
        try {
            String algorithm = "HmacSHA256";
            Mac mac = Mac.getInstance(algorithm);
            SecretKeySpec keySpec = new SecretKeySpec(webhookToken.getBytes(StandardCharsets.UTF_8), algorithm);
            mac.init(keySpec);

            // Compute signature
            byte[] signatureBytes = mac.doFinal(payload.getBytes(StandardCharsets.UTF_8));

            // Convert to hexadecimal string
            String hexDigest = bytesToHex(signatureBytes);

            return "sha256=" + hexDigest;
        } catch (Exception e) {
            throw new RuntimeException("err", e);
        }
    }
    
    private static String bytesToHex(byte[] bytes) {
        StringBuilder hexString = new StringBuilder();
        for (byte b : bytes) {
            String hex = Integer.toHexString(0xff & b);
            if (hex.length() == 1) {
                hexString.append('0');
            }
            hexString.append(hex);
        }
        return hexString.toString();
    }
}

# Golang

You can define the following VerifySignature function and call it when receiving a webhook request:

// Parameter descriptions
// payload: The request body of the webhook
// webHookToken: The generated webhookToken
// signature: The X-Fc-Webhook-Sign in the webhook request header
func VerifySignature(payload []byte, webHookToken string, signature string) bool {
	expectedSignature := computeWebHookSign(payload, webHookToken)
	return hmac.Equal([]byte(expectedSignature), []byte(signature))
}

func computeWebHookSign(payload []byte, webhookToken string) string {
	mac := hmac.New(sha256.New, []byte(webhookToken))
	mac.Write(payload)
	return "sha256=" + hex.EncodeToString(mac.Sum(nil))
}

# Python

You can define the following verify_signature function and call it when receiving a webhook request:

import hashlib
import hmac
def verify_signature(payload_body, secret_token, signature_header):
    """Verify that the payload was sent from GitHub by validating SHA256.

    Raise and return 403 if not authorized.

    Args:
        payload_body: original request body to verify (request.body())
        secret_token: GitHub app webhook token (WEBHOOK_SECRET)
        signature_header: header received from GitHub (x-hub-signature-256)
    """
    if not signature_header:
        raise HTTPException(status_code=403, detail="x-hub-signature-256 header is missing!")
    hash_object = hmac.new(secret_token.encode('utf-8'), msg=payload_body, digestmod=hashlib.sha256)
    expected_signature = "sha256=" + hash_object.hexdigest()
    if not hmac.compare_digest(expected_signature, signature_header):
        raise HTTPException(status_code=403, detail="Request signatures didn't match!")

# JavaScript

let encoder = new TextEncoder();

async function verifySignature(secret, header, payload) {
    let parts = header.split("=");
    let sigHex = parts[1];

    let algorithm = { name: "HMAC", hash: { name: 'SHA-256' } };

    let keyBytes = encoder.encode(secret);
    let extractable = false;
    let key = await crypto.subtle.importKey(
        "raw",
        keyBytes,
        algorithm,
        extractable,
        [ "sign", "verify" ],
    );

    let sigBytes = hexToBytes(sigHex);
    let dataBytes = encoder.encode(payload);
    let equal = await crypto.subtle.verify(
        algorithm.name,
        key,
        sigBytes,
        dataBytes,
    );

    return equal;
}

function hexToBytes(hex) {
    let len = hex.length / 2;
    let bytes = new Uint8Array(len);

    let index = 0;
    for (let i = 0; i < hex.length; i += 2) {
        let c = hex.slice(i, i + 2);
        let b = parseInt(c, 16);
        bytes[index] = b;
        index += 1;
    }

    return bytes;
}
© FinClip with ❤ , Since 2017