This topic describes how to obtain webhook URLs for DingTalk, Feishu, Slack, and Telegram bots and configure custom URLs in OceanBase Cloud.
Get a webhook URL for a DingTalk group chatbot
To get the Webhook URL for a DingTalk group chatbot, perform the following steps:
Note
For more information about chatbots on DingTalk, see Add a chatbot to a DingTalk group.
Open the DingTalk client and go to the group for which you want to receive alerts.
Click Group Settings > Bot > Add Chatbot.
Select Custom Chatbot.
On the Chatbot Details page, click Add.
On the Add Chatbot page, specify the relevant parameters.
ParameterDescriptionChatbot Name The name displayed for the chatbot in the group. Add to Group The current group by default. Security Settings The current version only supports security settings via custom keywords. Note
We recommend setting the custom keywords to OceanBase, OB, OBCloud, and test to properly receive OceanBase alerts.
Read the Custom Chatbot Service and Disclaimer, select the checkbox to confirm, then click OK.
On the information page after the chatbot is added, copy its Webhook URL.
Note
Save the webhook URL carefully and do not publish it on publicly accessible websites such as GitLab or blogs to prevent malicious use and spam messages if the URL is leaked.
Get a webhook URL for a Feishu group chatbot
To get the Webhook URL for a Feishu group chatbot, perform the following steps:
Note
For more information about chatbots on Feishu, see Add a custom bot (Lark developer guide).
Open the Feishu client and go to the target group.
In the upper-right corner of the group, click More and choose Settings > Group Chatbot > Add Chatbot.
Select Custom Chatbot.
Set the custom chatbot's Avatar, Name, and Description, then click Add.
On the chatbot details page, you can obtain the Webhook URL and configure security settings.
Note
Keep this Webhook URL confidential and do not publish it on publicly accessible websites such as GitLab or blogs to prevent malicious use and spam messages after the URL is leaked.
ParameterDescriptionWebhook URL Copy the Webhook URL of the chatbot. Security Settings The current version only supports security settings via custom keywords. Note
We recommend setting OceanBase and OB with custom keywords to ensure normal reception of OceanBase alerts.
Settings Configure chatbot management permissions.
Telegram bot
Follow these steps to obtain a webhook URL for a Telegram bot and configure it in OceanBase Cloud.
Create a Telegram bot to receive alerts.
Search for @BotFather in Telegram and open the chat.
Send
/newbotand follow the prompts to set the bot's display name and username.Record the bot's username and the API token returned by BotFather.
Note
Keep the API token confidential. Anyone with this token can fully control the bot.
Get the group chat ID.
Create a group chat, then search for and add the bot you created.
Send a command the bot can receive, such as
/start@<bot_username>. Replace<bot_username>with the bot's username.Telegram does not display group chat IDs in the client. Use the Bot API in a browser to retrieve the ID.
Open the following URL in a browser to retrieve the bot's recent updates:
https://api.telegram.org/bot<token>/getUpdatesReplace
<token>with the API token returned when you created the bot.Example:
https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1********/getUpdates.Note
You cannot use
getUpdatesif a Telegram outgoing webhook is configured for the bot.In the JSON response, find
result[].message.chat.id. Its value is the group chat ID.Note
The chat ID may change if the group is upgraded to a supergroup. Retrieve the new ID if this happens.
Build the webhook URL.
Use the following format. Replace
<token>with the bot's API token and<chat_id>with the group chat ID. OceanBase Cloud supplies the alert message when it calls the Telegram Bot API.https://api.telegram.org/bot<token>/sendMessage?chat_id=<chat_id>Example:
https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1********/sendMessage?chat_id=-45********Configure the Telegram webhook in OceanBase Cloud.
- On the page for creating or editing an alert contact, select Telegram in the Webhook section.
- Enter the URL you built and click Test.
- After the test succeeds, select the notification language and save the contact.
Slack bot
Follow these steps to obtain a webhook URL for a Slack bot and configure it in OceanBase Cloud.
Note
For details about Slack incoming webhooks, see Sending messages using incoming webhooks.
Open the Slack app management page and click Create New App.
Select From scratch, enter an app name, select a workspace, and click Create.
In the left-side navigation pane, select Incoming Webhooks and turn on Activate Incoming Webhooks.
Click Add New Webhook to Workspace.
Select the channel that will receive alerts and click Authorize. To select a private channel, you must be a member of that channel.
Copy the generated URL from Webhook URLs for Your Workspace.
Note
Keep the webhook URL confidential. Do not publish it on publicly accessible websites or in public code repositories.
In OceanBase Cloud, open the page for creating or editing an alert contact. Select Slack, enter the webhook URL, and click Test.
After the test succeeds, select the notification language and save the contact.
Custom URL
To configure a custom webhook URL when creating or editing an alert contact:
Select Custom URL in the Webhook section.
Enter the webhook URL and configure the following settings as needed.
ParameterConfigurationHTTP Header Enter an HTTP header name and value. You can add multiple headers, such as API-Key: ******andContent-Type: application/json;charset=UTF-8.Request Method Select POST or PUT. Success Response Validation Rule Specify how to determine whether an HTTP request succeeded. Do not use dynamic fields such as IDs, timestamps, trace IDs, or sequence numbers. The system checks the response body against the rule. For a JSON response, specify a fixed key-value pair, such as {"code":"SUCCESS"}. A response containing that pair is considered successful. For other response formats, specify a regular expression. A matching response is considered successful.Click Test. After the test succeeds, select the notification language and save the contact.
Note
If a firewall blocks the custom webhook URL, contact OceanBase Technical Support for assistance.