Send simple text message to wechat user from server side - c#

I have wechat app on Android, in Settings->MyAccount I set WeChat ID "my-wechat-unical-id".
In WebForms project I add WeChat.SDK 1.0.1.9
now I obtain ACCESS_TOKEN like this:
https://api.wechat.com/cgi-bin/token?grant_type=client_credential&appid=my_appid&secret=my_secret
How I can to send simple message to 'my-wechat-unical-id' if this person is not my follower, can I send to him some message or notification in wechat?

Related

How to use FCMClient to send messages to both Android and iPhone

Im using FCMClient in an MVC application to send alerts/messages to Android and iPhones.
I initialise https://github.com/tiagomtotti/firebaseNet/blob/master/src/FirebaseNet/Messaging/Message.cs and then send a message.....
var msg = new Message
{
To = token,
Data = someData
}
This sends alerts to an Android but not an iPhone. I looked at the documentation https://github.com/tiagomtotti/firebaseNet
and can see two classes AndroidNotifcation and IosNotification (https://github.com/tiagomtotti/firebaseNet/tree/master/src/FirebaseNet/Messaging)
I now noticed the Message class takes in an Interface for both notifications but how could setup the Message class to take in a notification but targets both Android and IoS?

Group PWA notifications on Android

I'm using the WebPush c# assembly (v1.0.11) to send push notifications to my PWA.
My payload looks like this:
{
"notification":{
"title":"My Message",
"body":"Hello World, here is a message for you",
"data":{
"FromContactpersonId":"e3600a03-836e-4c01-42c7-08d879cb6c81"},
"badge":"assets/icons/badge72push.png"}
}
Now I want to group the notifications on android. If I set tag in the payload it will replace the last message, but I want them all to show, just stacked, like the e-mails in this example (compared to my own, which are not stacked):
I tried adding android_group but the messages do not get stacked at all.
How can I send them so they will be stacked on my android device?
Thanks, Sam

Telegram Bot: get chat Id group

I've created a Telegram Bot using C# and I want to see who is using my bot when sending message.
I can get when people send a message to my bot in private chat but in the Groups, I can't get Username who is using Bot and it's return the GroupName.
The method I use is
var me = Bot.GetChatAsync(e.Message.Chat.Id).Result;
From doc this field User is optional for groups.
You can see who send message in e.Message.From, this property returns who send it as User.
And you should await methods that is awaitable.
And in your case Bot.GetChatAsync, this will return Chat from ChatId.
It means: Info about chat from Id.
And you pass Chat not ChatId to Bot.GetChatAsync

How would I only allow only certain messages to be set users [NODE.JS]

I am working on a mutliplayer game and decided to use NodeJS aspart of the system.
The nodeJS is linked to m c# game emulator via TCP.
However how would I send messages to certain user ID?
Each individual user in the database is sided by a unique user ID (E.G 1)
How can I do this so if a user in game does a certain thing and that sends a message
from Node ONLY TO THEM.
Since I can't run node on the same port as my cms (Port 80).
I need a method in which I can use PHP to pull the ID or something.
Use as Jquery and 'GET'? I'm suck.
By message I mean data such as sending a javascript window.
Options available:
JQuery
Javascript
PHP
Node
I thought of a method were the user id is presented within a div through a parameter in PHP (E.G $ID) and then javascript checked against the div and the message to see if the ids matched. Then within the message the users ID would be included, then somehow I could split the message? so its "","" (ID,MESSAGE)
Code:
var socket = io.connect('http://dev.com');
socket.on('field', function (data) {
if ($("#userid").text().indexOf(data) > -1)
{
window.alert('lol');
console.log(data);
$("#field").html(data);
}
else
{
window.alert("Something has gone wrong with the node server...");
}
});
It didn't work.
THE PAGE:
THE C#:
THE NODE:
Based on your response in the comments:
Inside the messages are just html that node sends to the page via a Node HTTP server. The messages aren't big just little things like "window.open("google.com");. Messages are only triggered if a user clicks a certain thing within game and no.
It sounds to me like what you really want is some sort of RPC. There's a solid NPM module called Socket.IO which wraps all this up nicely for you. Fire an event, it can be handled server-side, and any callback data gets sent back to the client.
http://socket.io/docs/

Send sms Silently in WP8

I was trying to send sms to a group of contacts via SmsComposeTask class.
But this class's Show() method only composes message in message app. I also want my code to send those texts automatically. Please help!!
Here is what i am using:
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = recipients; // recipients is the group of contacts
smsComposeTask.Body =
"Hello! This is a test sms message!";
smsComposeTask.Show();
See: http://social.msdn.microsoft.com/Forums/wpapps/en-us/85dc6ef5-98a9-4a17-a5f0-171372d8d9a3/how-to-send-sms-from-a-windows-phone-page
using Microsoft.Phone.Tasks;
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = "2065550123"; smsComposeTask.Body = "Your SMS
text";
smsComposeTask.Show();
After that a dialog will be show asking the
user whether to send the message.
You cannot silently send an SMS
Also: https://developer.nokia.com/Community/Wiki/How_to_send_an_SMS_in_Windows_Phone
Note: In contrast to Symbian, Windows Phone does not allow you to send
sms "directly" or "silently" from your own app. As soon as sms sending
initiation code below is executed the native sms editor app will be
launched, giving the user the option to send the message or not.
I image this is done so that rouge apps can't send out a bunch of texts that will cost someone money.

Categories