Slack is one of the leading communication platforms for millions of users. With it, you can perform instant messaging, document sharing, and a variety of other activities to improve the collaboration between team members. You can also automate or control many things with Bots in Slack by using IDE Software.
Can you create Slack Bots using Delphi?
Yes you can!
SDriver is a Delphi wrapper for Slack API by Andrea Magni who is one of the Embarcadero MVPs. SDriver is a free and open-source wrapper for Delphi developers.
The best thing is that the wrapper utilizes the native HTTP client libraries for each supported platform – System.Net.HttpClient. And also implemented with System. Threading library to work asynchronously.
What are the features of SDriver?
- Compatible with FireMonkey, Visual Component Library, and also Non-visual components
- Support for Message Attachments
- Support for Incoming Webhooks
- Implemented using Native HTTP Client Libraries
- Async implementation using Parallel Programming Library
What are “Incoming Webhooks” in Slack?
Incoming Webhooks are a simple way to post messages from apps into Slack. By creating an Incoming Webhooks you get a unique URL which you can send a JSON payload with the message text and some options.
1 2 3 4 5 |
POST https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX Content-type: application/json { "text": "Hello, world." } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
implementation {$R *.dfm} uses System.Diagnostics , SDriver.Message, SDriver.Interfaces, SDriver.IncomingWebHook; procedure TForm1.SendActionExecute(Sender: TObject); var LWebHook: IMessageBuffer; LMessage: IMessage; LStopWatch: TStopWatch; begin LStopWatch := TStopWatch.StartNew; LMessage := TMessage.Create(EditMessage.Text + ' [' + TimeToStr(Now) + ']'); LMessage.UserName := EditUserName.Text; LMessage.Icon_URL := EditIcon_URL.Text; LMessage.Icon_Emoji := EditIcon_Emoji.Text; LMessage.Channel := EditChannel.Text; LWebHook := TIncomingWebHook.Create(EditWebHookURL.Text, False); LWebHook.Push(LMessage); LWebHook.Flush; end; procedure TForm1.SendActionUpdate(Sender: TObject); begin SendAction.Enabled := (EditWebHookURL.Text <> '') and (EditMessage.Text <> ''); end; |
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition