How to send a message to Slack workspace members using an SQL statement

AndySqlman - Sep 4 - - Dev Community

Reposted from https://www.sqlmessenger.com/docreader.html?id=556

Q: How to send a message to Slack workspace members using an SQL statement?

A: You can use the "External Interface" feature of SQLMessenger to achieve this function. This method supports PostgreSQL, MySQL, SQL Server, Oracle, and Informix databases.

Step 1: Configure the Slack App in SQLMessenger.
For specific steps, please refer to Sending Messages to Slack Workspace Members via Slack API.

Step 2: Create datasource in SQLMessenger and enable the option "Allow sending messages to Slack from the interface table in this data source".

  • Create datasource in SQLMessenger
    Image description

  • Enable the option "Allow sending messages to Slack from the interface table in this data source"
    Image description

Step 3: Insert data into the interface table to send messages to members of your Slack workspace.

  • After enabling this option, SQLMessenger will create a table named 'sqlmessenger_intf' in the datasource. You can insert data into this table to send messages to members of your Slack workspace.

  • For example, to send a message to a member with member ID "U015NGUUGQ0" through the Slack App named "MySlackApp", you can use the following statement:

INSERT INTO sqlmessenger_intf
            (oper_type,
             slack_app_name,
             send_to,
             body)
VALUES      ( 'S',--Operation type. "S" indicates to send a message to Slack workspace members via Slack API.
             'MySlackApp',--Specify which Slack app to use for sending this message.
             'U015NGUUGQ0',--The Slack workspace members who will receive this message. Separate multiple members with a comma (",").
             'This is a test message' --The content of the message.
);
Enter fullscreen mode Exit fullscreen mode

Related Document: Using External Interface, DataSource Management, Sending Messages to Slack Workspace Members via Slack API

. . . . . . . . . . . .
Terabox Video Player