Hello people,
Good Morning!
In this post I will demonstrate how to do a database integration with the Ryver and send messages using CLR (C #), which is Slack's main competitor, in which I have already demonstrated how to do this same post integration SQL Server - How to Integrate Database with Slack and Send Messages Using CLR (C #).
If you don't know or know how to use CLR in SQL Server, find out how to access the post. Introduction to SQL Common Language Runtime (CLR) in SQL Server.
What is Ryver?
For those who do not know, the Ryver is one of the most famous and widely used corporate communicators in the world, Slack's main competitor, and is proposing to replace email communication with private and public (in-team) forums focused on particular teams and / or topics. You can create public groups where your entire team can interact and collaborate, and private groups for each industry where only those in the group can view messages.
Ryver lets you reply to emails through its own tool, sending and sharing files (no storage limit), sending private messages and more all for free (no premium versions, advertisements and no paid features).
Where and how can I use Ryver in my business?
This feature is especially useful for building teams in your company and generating alerts and monitoring by team, where each team receives alerts only for their activities. In addition, you can use open groups to send information and notifications that matter to the entire company. All at no cost and you can receive by email, view on the web and on your smartphone.
Another cool way to use Ryver is to send sales target tracking to the sales department so that regional and local managers can track sales team performance in real time without having to consult and open up. reports wherever they are, even outside the company.
If your company adopts Ryver, HR can use the service to send messages and information to employees. Send Christmas messages, a special message on the employee's birthday, etc.
Anyway, the advantage of Ryver is that it can be sent in many different ways (Email, Web, Smartphone) wherever you are, inside or outside the company and it represents a big revolution in the way people interact with The informations.
How to add users to Ryver
The first step in creating the integration is to create your Ryver account, accessing this link. Once created, you will receive an email to log in to your account.
Once you have created your account, the next step is to create a user that your application or tool will use to send messages. This user must be present in all groups, otherwise messages cannot be sent to this group.
To add new users, click on your name in the lower left corner and select the “Admin Settings” option.
On the screen that will open, click on the “Invite User” button and a new window will open, where you will enter the emails of the people you want to invite to your Ryver account. I recommend that you add a user exclusively for sending messages, but if you want, you can use your own user.
To create some examples, I will create a free forum and some private teams, as below:
How to integrate the database with Ryver
Once you have created your Ryver account and registered the user you will use to send messages to teams, let's go to the interesting part: Create the .NET (C #) code that will perform SQL database integration Server with the Ryver API.
As a prerequisite for using this procedure, you will need to create the Return class, available in the post. SQL Server - How to send warnings and error messages to the bank through CLR (C #) to use the method Return.Error and thus send error messages if they occur. You can also choose to comment out the code and remove calls to this method (and also comment out using Libraries.Model), but I don't advise because you won't know when there was an error in your call to SP sending Ryver. .
How to identify the forum or private room ID:
Stored Procedure Source Code:
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | using System; using System.Data.SqlTypes; using System.IO; using System.Net; using System.Text; using Bibliotecas.Model; public partial class StoredProcedures { [Microsoft.SqlServer.Server.SqlProcedure] public static void stpEnvia_Mensagem_Ryver(SqlString Ds_Tipo, SqlInt64 Nr_Time, SqlString Ds_Mensagem) { const string urlRyver = "nome_do_seu_time"; const string usuario = "usuario_ryver"; const string senha = "senha_ryver"; var dsTipo = Ds_Tipo.Value.ToLower(); if (dsTipo != "forums" && dsTipo != "workrooms") Retorno.Erro("O valor do parâmetro 'Ds_Tipo' não está entre as opções possíveis (workrooms / forums)"); try { var dsScript = "{\"body\": \"" + Ds_Mensagem.Value + "\"}"; var url = $"https://{urlRyver}.ryver.com/api/1/odata.svc/{dsTipo}({Nr_Time.Value})/Chat.PostMessage()"; var request = (HttpWebRequest) WebRequest.Create(url); request.Method = "POST"; var svcCredentials = Convert.ToBase64String(Encoding.UTF8.GetBytes(usuario + ":" + senha)); request.Headers.Add("Authorization", "Basic " + svcCredentials); request.UserAgent = "curl/7.45.0"; request.ContentType = "application/json"; request.Accept = "application/json"; var buffer = Encoding.GetEncoding("UTF-8").GetBytes(dsScript); using (var reqstr = request.GetRequestStream()) { reqstr.Write(buffer, 0, buffer.Length); using (var response = request.GetResponse()) { using (var dataStream = response.GetResponseStream()) { if (dataStream == null) return; using (var reader = new StreamReader(dataStream)) { var responseFromServer = reader.ReadToEnd(); Retorno.Mensagem(responseFromServer); } } } } } catch (Exception e) { Retorno.Erro("Erro : " + e.Message); } } }; |
Usage examples for open group
1 2 3 4 5 | -- Enviando mensagem para o grupo aberto "Grupo Livre" EXEC CLR.dbo.stpEnvia_Mensagem_Ryver @Ds_Tipo = N'forums', -- nvarchar(max) @Nr_Time = 1094440, -- bigint @Ds_Mensagem = N'Teste de Mensagem para o fórum \"Forum Livre\"' -- nvarchar(max) |
Usage examples for private group
1 2 3 4 5 | -- Enviando mensagem para o grupo privado "TI" EXEC CLR.dbo.stpEnvia_Mensagem_Ryver @Ds_Tipo = N'workrooms', -- nvarchar(max) @Nr_Time = 1094441, -- bigint @Ds_Mensagem = N'Teste de Mensagem para o grupo privado \"TI\"' -- nvarchar(max) |
That's it folks!
I hope you enjoyed this post.
A hug and see you next.
sql server clr .net dotnet framework C # csharp integration how to create database integration database how to send messages how to send messages notifications private group dm Ryver
sql server clr .net dotnet framework C # csharp integration how to create database integration database how to send messages how to send messages notifications private group dm Ryver
Ryver survives from what?
Thiago,
Good day.
Ryver survives through Ryver Task Manager, which is a paid product that integrates with Ryver Team Communication.
https://ryver.com/ryver-vs-slack/