--- title: "Add trigger" slug: "cloudfunctions-example04" tags: ["Cloud Functions examples", "Cloud Functions"] updated: 2026-09-17T09:17:40Z published: 2026-09-17T09:17:40Z canonical: "guide.ncloud-docs.com/cloudfunctions-example04" --- > ## Documentation Index > Fetch the complete documentation index at: https://guide.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # Add trigger Available in Classic and VPC Here is an example to help you understand how to add triggers that run actions. This example creates a trigger that updates user location and calls the hello action when the user location is updated. For learning this example, see the following guides: - How to create an action - Cloud Functions > Action > Create action ## Create action 1. Write source code that receives and outputs name and location. ``` function main(params) { return {payload: 'Hello, ' + params.name + ' from ' + params.place}; } ``` 1. Create an action in the console using the source code written in step 1. ![cloudfunctions-example04_v2_01_ko](https://cdn.document360.io/6998976f-9d95-4df8-b847-d375892b92c2/Images/Documentation/cloudfunctions-example04_v2_01_en.png?sv=2026-02-06&spr=https&st=2026-11-14T04%3A24%3A15Z&se=2026-11-14T05%3A24%3A15Z&sr=c&sp=r&sig=5DRdcfQH0vtNEMZyT2pdKI%2B6SwyiClP%2FHIbWzJsahpU%3D) ## Add trigger You can add a trigger that runs actions as follows: 1. Go to action details by selecting the action named helloAction created in the console. ![cloudfunctions-example04_v2_02_ko](https://cdn.document360.io/6998976f-9d95-4df8-b847-d375892b92c2/Images/Documentation/cloudfunctions-example04_v2_02_en.png?sv=2026-02-06&spr=https&st=2026-11-14T04%3A24%3A15Z&se=2026-11-14T05%3A24%3A15Z&sr=c&sp=r&sig=5DRdcfQH0vtNEMZyT2pdKI%2B6SwyiClP%2FHIbWzJsahpU%3D) 2. Click **[Add]** in the trigger section. 3. Select **Create new** for connection method and select **API Gateway** for type. ![cloudfunctions-example04_v2_03_ko](https://cdn.document360.io/6998976f-9d95-4df8-b847-d375892b92c2/Images/Documentation/cloudfunctions-example04_v2_03_en.png?sv=2026-02-06&spr=https&st=2026-11-14T04%3A24%3A15Z&se=2026-11-14T05%3A24%3A15Z&sr=c&sp=r&sig=5DRdcfQH0vtNEMZyT2pdKI%2B6SwyiClP%2FHIbWzJsahpU%3D) 4. Configure settings to create API Gateway endpoint that will call the action through API Gateway. ![cloudfunctions-example04_v2_04_ko](https://cdn.document360.io/6998976f-9d95-4df8-b847-d375892b92c2/Images/Documentation/cloudfunctions-example04_v2_04_en.png?sv=2026-02-06&spr=https&st=2026-11-14T04%3A24%3A15Z&se=2026-11-14T05%3A24%3A15Z&sr=c&sp=r&sig=5DRdcfQH0vtNEMZyT2pdKI%2B6SwyiClP%2FHIbWzJsahpU%3D) ## Check run results You can run the trigger and check if the action runs properly. To check, take the following steps: 1. Run the action by calling the API Gateway endpoint. For detailed run methods, see [Run trigger in API Gateway trigger](/docs/en/cloudfunctions-apigateway-vpc#%ED%8A%B8%EB%A6%AC%EA%B1%B0%EC%8B%A4%ED%96%89). ``` curl -X POST -H "Content-Type: application/json" https://func.apigw.ntruss.com/api/v1/hello?blocking=true&result=true -d '{"name": "Cloud Functions", "place": "NAVER Cloud"}' ``` 1. Check detailed information about run results in the **Monitoring** tab menu of the action details screen. Check if the action ran by viewing the most recent activation information and verify that the action triggered processes parameters correctly. ![cloudfunctions-example04_v2_05_ko](https://cdn.document360.io/6998976f-9d95-4df8-b847-d375892b92c2/Images/Documentation/cloudfunctions-example04_v2_05_en.png?sv=2026-02-06&spr=https&st=2026-11-14T04%3A24%3A15Z&se=2026-11-14T05%3A24%3A15Z&sr=c&sp=r&sig=5DRdcfQH0vtNEMZyT2pdKI%2B6SwyiClP%2FHIbWzJsahpU%3D)