Webhook is a mechanism for one system to notify another system about events in that system. The "Incoming webhook" block is used as a starting block in a handling webhook script.
The parameters that we are going to receive are added to the block. Local variables are automatically created with the same name as you specified for the parameters. These variables will hold the values that are transferred in the request.
A request is a link that is displayed at the bottom of the block. It is used to trigger a script to accept a request from third-party services.
Example: you want a message to be sent to the client when a deal card is moved to the CRM with a request for an estimate. To do this, you need to specify the client's phone number and name in the request, so that the bot will know to which phone to send the message and how to address it
Only the "Send message*" and “Condition” blocks can be linked to the "Incoming webhook" block now. We are working on expanding the list of supported blocks.
Setting up the "Incoming webhook" block
1. Copy the link from the block;
2. Place the required parameters in the link after the token. Parameters are separated by & sign.
For example, in “https://devconstructorbot.chatapp.online/api/request/get/?token=” token is self-generated&chat_id= customer's phone number &id= card ID;
3. Create fields and write in them the parameters you added to the link.
If you take the link from the example in the previous paragraph, you need to create two fields and write "chat_id" in the first one and "id" in the second one;
4. Add a block "Send message*";
5. In "ChatID" select "chat_id";
6. In "Line" select the line from which the message will be sent;
7. In "Messenger" select the messenger from which the message will be sent;
8. Enter a name for the script;
9. Click "Save" and "Publish";
10. Now you need to go to the service that will send the request and configure the outgoing webhook in it. The configuration process may vary from service to service. For an example, see the article "Outbound webhook Bitrix24".
The “Incoming webhook” block accepts both GET and POST requests.