I. Intro
A webhook is a method for one app to provide another app with real-time information. Using a webhook, flows can be automatically run when HTTPS requests are received.
Organizations can connect business systems to BotBuilder through webhooks, which allows you to automatically receive data from other apps or services without writing code. For example, you can:
- Send a Feishu message through a bot when a new customer is added to the internal CRM system
- Send a Feishu message through a bot when there is a system alert
- Log landing pages you've created or leads you've gathered in a base or spreadsheet
II. Steps
Open Feishu BotBuilder and click Create Bot App. Configure the name, description, and icon of the new app. On the Form Design tab, click Create.
250px|700px|reset
250px|700px|reset
Open the Select a trigger pane, and select Webhook trigger as the trigger.
250px|700px|reset
Copy the URL from the pane and paste it into the webhook configuration section of the app you want to connect. This allows Feishu to receive data sent from that app.
250px|700px|reset
Return to the configuration page, and fill in the JSON data format or sample data that will be pushed via the webhook. The corresponding key values can be used by the following steps in the workflow.
Note: Parameters must be enclosed in curly braces and consist of a message_type and key-value pairs. The message_type must be set to text, and the keys should be strings. Values can be strings, numbers, booleans, arrays, objects, or null. For example, if you want to retrieve the ID field, you can include sample data like "id": 1; if you want to retrieve a name field, you can include "name": "Tom".
250px|700px|reset
In the example of the step Send messages via BotBuilder BOT, the key value from the preceding webhook step can be used for the message content.
250px|700px|reset
After completing the configuration, you can send an HTTP POST request to the above webhook address through the curl command to test the function.
- For Mac: Open the Terminal application on your computer and run the following command.
curl -X POST -H "Content-Type: application/json" \
-d '{"msg_type":"text","content":{"id":"1","name":"Tom"}}' \
Fill in the webhook address here
- For Windows: Press Win + R to open the Run dialog box on your computer. Enter cmd, press Enter, then run the following command.
curl -X POST -H "Content-Type: application/json"
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"request example\"}}"
Fill in the Webhook address here
III. FAQs