[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eCustom events are user-defined actions that occur outside of direct end-user conversation, such as button clicks or time-based triggers.\u003c/p\u003e\n"],["\u003cp\u003eThese custom events can be invoked either through fulfillment or via the API's \u003ccode\u003edetectIntent\u003c/code\u003e call, using the \u003ccode\u003equeryInput.event\u003c/code\u003e field.\u003c/p\u003e\n"],["\u003cp\u003eWhen invoking events with fulfillment, the \u003ccode\u003efollowupEventInput\u003c/code\u003e field of the \u003ccode\u003eWebhookResponse\u003c/code\u003e is used, allowing for the specification of event names, optional parameters, and the language code.\u003c/p\u003e\n"],["\u003cp\u003eUpon receiving a webhook response with a custom event, Dialogflow triggers the corresponding intent, essentially redirecting the conversation flow to a new intent, ignoring any other fields in the response.\u003c/p\u003e\n"],["\u003cp\u003eChaining multiple intents is possible, as a triggered intent can also invoke another event via fulfillment, but this chaining is limited to a maximum of three intent matches, where each webhook response must adhere to timeout restrictions.\u003c/p\u003e\n"]]],[],null,["# Custom events are events that you define.\nThey are used to handle things that happen\noutside the conversation with the end-user.\nFor example,\nthe end-user clicked a button,\na certain amount of time has passed,\navailable inventory has changed during the conversation,\nand so on.\n\nYou can invoke these events using either\n[fulfillment](/dialogflow/docs/fulfillment-overview)\nor\n[the API](/dialogflow/docs/api-overview).\n\nInvoke events with the API\n--------------------------\n\nThe request for a\n[`Sessions`](/dialogflow/docs/reference/common-types#sessions)\ntype `detectIntent` call contains a `queryInput.event` field,\nwhich is used to invoke events.\nThe type of this field is a `EventInput`,\nand it contains fields for the event name,\n[optional parameters](/dialogflow/docs/events-overview#param),\nand the language code.\n\nWhen you provide an event to a detect intent call,\nyou do not provide other data, like an end-user expression.\nThe call's sole purpose is to invoke an event and trigger an intent.\n\nInvoke events with fulfillment\n------------------------------\n\nYou can invoke events via\n[fulfillment](/dialogflow/docs/fulfillment-overview)\nby setting the `followupEventInput` field of the\n[`WebhookResponse`](/dialogflow/docs/reference/common-types#webhookresponse).\nYou can optionally set the `followupEventInput.parameters` field to provide\n[parameters](/dialogflow/docs/events-overview#param)\nto the intent.\n\nFor example: \n\n {\n \"followupEventInput\": {\n \"name\": \"event-name\",\n \"parameters\": {\n \"parameter-name-1\": \"parameter-value-1\",\n \"parameter-name-2\": \"parameter-value-2\"\n },\n \"languageCode\": \"en-US\"\n }\n }\n\nWhen the `followupEventInput` parameter is set for a `WebhookResponse`,\nDialogflow ignores the `fulfillmentText`, `fulfillmentMessages`,\nand `payload` fields.\nIn addition, the `followupEventInput.languageCode` field is a required field,\nbut Dialogflow ignores this field,\nbecause the language was already defined\nin the originating detect intent request.\n\nWhen Dialogflow receives a webhook response that includes an event,\nit immediately triggers the corresponding intent in which it was\n[defined](/dialogflow/docs/events-overview#config).\n\nThe following flow describes the steps:\n\n1. The end-user types or speaks an expression.\n2. Dialogflow matches the end-user expression to **Intent-1**, which is configured for fulfillment.\n3. Dialogflow sends a webhook request to your server.\n4. Your server responds with a webhook response that includes a followup event.\n5. Instead of responding to the user for the **Intent-1** match, Dialogflow triggers **Intent-2**, which is configured for the event.\n6. Dialogflow proceeds as though the end-user initiated the match for **Intent-2** and handles required parameters and fulfillment as dictated by the configuration of **Intent-2**.\n\nChaining intent matches with webhook response events\n----------------------------------------------------\n\nIt is possible to chain intent matches with webhook response events.\nIn the flow described above,\n**Intent-2** could also be configured for fulfillment.\nIf your server's webhook response supplies another event,\nDialogflow proceeds to match **Intent-3** (configured for the event)\nwithout responding to the end-user for **Intent-2**.\n\nDialogflow does not respond to the end-user until the chain has ended.\nWhen chaining intents in such a way,\neach webhook response must be sent within\n[timeout restrictions](/dialogflow/docs/fulfillment-how#webhook_response).\n| **Note:** You can chain *at most* 3 intent matches in this way."]]