UNABLE TO UNSUBSCRIBE HUOBI WEBSOCKET TICKER SUBSCRIPTION - sockets

I'm trying to unsubscribe from a HUOBI websocket server but the server is keep sending me the datas.
I contacted to support but so far there is no news. Is there anyone who is achieved to unsubscribe?
As far as I checked from their API, this is what should I send for unsubscription.
console.log("Unsubscribing Huobi for symbol: " + symbol)
ws.send(JSON.stringify({
"unsub": `market.${symbol}.ticker`,
"id": `${symbol}`
}));
And this is how I subscribed;
console.log("Subscribing Huobi for symbol: " + symbol)
ws.send(JSON.stringify({
"sub": `market.${symbol}.ticker`,
"id": `${symbol}`
}));

I just received a confirmation from Huobi support. They solved the issue. Now, I'm able to be unsubscribed properly. FYI –

Related

Flutter web fcm messages is recieved from console but not when using rest api

Hope someone can assist. Been struggling now for about 2 weeks to get the fcm push notification working on flutter web app. Using flutter 3.0.7.
I created a firebase project and set it up with cli and recieved a firebase_options.dart file with the web options. Then created a firebase-messaging-sw.js file.
When testing from firebase console I recieve a message. But as soon as I use the rest api to send a message it shows it send the message but no message is recieved. It show the following
FCM request for web sent!
{"multicast_id":3383324657233668851,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}
]}
FCM request for web sent!
{"multicast_id":5796359055236685312,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}
]}
I use the following to send the message after getting the registered key of the device I would like to send to
sendPushMessageToWeb(String? token) async {
final endpoint = "https://fcm.googleapis.com/fcm/send";
final header = {
'Authorization': 'key=7rZmxGEjVqGk0JPi0Fospb0Us47eIn8IqIDeobU8KGFbMoAYTZ-',
'Content-Type': 'application/json'
};
http.post(
Uri.parse(endpoint),
headers: header,
body: jsonEncode({
"to": "${token}",
"notification": {"body": "YOUR NOTIFICATION BODY TEXT", "title": "YOUR NOTIFICATION TITLE TEXT", "sound": "default"}
})
)
print('FCM request for web sent!');
}
It looks like it complains about the registration key but using that same key in console works.
Why would it send and recieve message from console but not from rest api? I did not made any changes in my index.html file for the code lab I used at first and is unable to find again after all my searches did not mension anything about the changes and the console messages is recieved.
Thank you
My own mistake for not thinking. I never checked the length of the token. The variable on my php mysql was only 100 long but the token is longer than that. Thank you.

Teams not displaying email sent via SendGrid

I'm trying to post to a Teams channel via the email address using SendGrid. However, the emails I send via SendGrid are not appearing. I ended up adding my personal email address as well, and I do receive that one as well as seeing the Teams email address in the To: field. I can also see in SendGrid dashboard that the email was send and delivered to the Teams channel address. I have validated that this address is correct, and have also posted via my non-work email address to that channel, so I know it's not because of a typo or an external email address. My guess is that there is something in the email meta data that is making Teams reject the email? Anyone have ideas 1) why Teams won't post the email coming from SendGrid and 2) how I might modify my request in SendGrid so that it works? Also, alternative suggestions on sending emails (for free) from nodejs are welcome.
Here is the code I'm using to send the email for reference:
var msg = {
to: ['TEAMSCHANNELID#amer.teams.ms','mycompanyemail#company.com'], // ChatBot Support Team, General Channel
from: 'noreply#chatbotapimonitor.com',
subject: `Service Interruption Notice: API ${test} is down (via ${functionName})`,
text: `API ${test} failed with error ${error}`,
html: `API ${test} failed with error ${error}`
};
try {
await sgMail.send(msg);
} catch (err) {
context.log(err);
}
It turns out that Teams won't accept incoming emails if the From address domain does not match the actual "sent from" domain. I recognized this by the "Sent via sendgrid.net" message I saw in Outlook when the emails were sent to me as well.
I was able to get the out of the box Incoming Webhooks enabled, and using that instead of SendGrid emails got around the problem. I got the URL from the webhook configuration and then was able to call it like so:
var headers = { 'ContentType': 'application/json'}
var body = {
'#context': 'https://schema.org/extensions',
'#type': 'MessageCard',
'themeColor': 'FF0000',
'title':`API ${test} is down: Service Interruption Notice`,
'text': `API ${test} failed with error ${error}.\n\r\n\rReported by ${functionName} during test started on ${now.toString()}`
};
var res = await request({
url: url,
method: 'POST',
headers: headers,
json: body,
rejectUnauthorized: false
});
The themeColor doesn't appear in all channels, but I have it working as a nice red/green indicator on Teams desktop.
Perhaps your organization limits the sending ability to only certain domains? Someone with admin rights can check it under Teams settings => Email integration
yeah that's what I meant - making your own Connector app and side-loading. If you go ahead with it, please let me know - would love to know how it works out
Yes exactly making your own Connector would work.

Skype Bot sending message (not a reply)

Trying to create a Skype Bot, but I have a problem. Please, help me.
I use PHP so I use REST (not NodeJS or C# SDK).
The task: I have to send data from html form on my website to Skype (so I don’t have to reply to a message, but just send).
Well, I have successfully create a bot in Microsoft Bot Framework.
Then I have successfully received an access_token.
Then they say in docs that I have to send a POST to:
/v3/conversations/{conversationId}/activities
According to https://learn.microsoft.com/en-us/bot-framework/rest-api/bot-framework-rest-connector-send-and-receive-messages I have to send a request to /v3/conversations with JSON like that:
{
"bot": {
"id": "12345678",
"name": "bot's name"
},
"isGroup": false,
"members": [
{
"id": "1234abcd",
"name": "recipient's name"
}
],
"topicName": "News Alert"
}
But what is the "member's id and member's name"?
To get the member ids of some members, add all those members in a group and add the bot, too, to the group and preferably send a message in the group, mentioning the bot. You will receive a json with a conversationId. With this conversationId, make a get request to v3/conversations/{conversationId}/members in order to receive the member-ids and member-names of the members in the group.
You can now proceed with these member-ids and member-names to start individual conversations with the members (which is illustrated in my answer to this question).

How can I send a message to someone with my telegram bot using their Username

I am using the telepot python library, I know that you can send a message when you have someone's UserID(Which is a number).
I wanna know if it is possible to send a message to someone without having their UserID but only with their username(The one which starts with '#'), Also if there is a way to convert a username to a UserID.
Post one message from User to the Bot.
Open https://api.telegram.org/bot<Bot_token>/getUpdates page.
Find this message and navigate to the result->message->chat->id key.
Use this ID as the [chat_id] parameter to send personal messages to the User.
It is only possible to send messages to users whom have already used /start on your bot. When they start your bot, you can find update.message.from.user_id straight from the message they sent /start with, and you can find update.message.from.username using the same method.
In order to send a message to "#Username", you will need them to start your bot, and then store the username with the user_id. Then, you can input the username to find the correct user_id each time you want to send them a message.
You can't send message to users using their username that is in form of #username, you can just send messages to channel usernames which your bot is administrator of it. Telegram bot api uses chat_id identifier for sending messages. If you want to achieve chat_id of users, you can use telegram-cli, but it's not easy at all because that project is discontinued and you should debug it yourself.
in your case you should do following command:
> resolve_username vahid_mas
and the output will be something like this:
{
"user": {
"username": "Vahid_Mas",
"id": "$010000006459670b02c0c7fd66d44708",
"last_name": "",
"peer_type": "user",
"print_name": "Vahid",
"flags": 720897,
"peer_id": 191322468,
"first_name": "Vahid",
"phone": "xxxxxxx"
},
"online": false,
"event": "online-status",
"state": -1,
"when": "2017-01-22 17:43:16"
}
As the user you want to learn the ID of, send a message of any content to #JsonDumpBot. It will reply the whole JSON element that it receives from Telegram, including the ID of the user:
It's totally not safe to use other telegram versions available on internet, but I've seen that Telegram Plus has a ability to show you the chat_id of the user in their profile, even tho you don't have their contact.
Another way to extract chat_id of that particular user is that you have the phone number of that account, save it as your contact, then share it to this bot. It's easy to code it yourself but you can forward something from that user to this bot too, if you want to recieve the chat_id.
urmurmur has also mentioned another way. I haven't checked it yet but seems to be interesting.
Maybe you can try telethon:
from telethon import TelegramClient
def send_msg(name, msg):
with TelegramClient(session_file, app_id, app_hash, proxy=my_proxy) as client:
# client.loop.run_until_complete(client.send_message('me', 'hello')) # send 'hello' to saved messages
client.loop.run_until_complete(client.send_message(name, msg))
"name" can be "#xxxxx".
Then you can call send_msg(name, msg) in your bot.

Venmo API returns undocumented error 1396 on payment endpoint

The error looks something like this
request.post({
url: 'https://api.venmo.com/v1/payments',
form: {
access_token: 'xxxxxxxxxxxxxxxxxxxxxx',
email: req.body.email,
note: 'Payment of ' + req.user.coins + ' coins',
amount: (req.user.coins * coin_price),
audience: 'public',
confirm: true
}
}, function(err, httpResponse, body) {
console.log(err, body)
} )
and the json response looks like this
{"error": {"message": "Please confirm whether you would like to pay a fee on this transaction", "code": 1396}}
I feel this is because on my account I have a credit card that requires a 3% fee. But I am fine with it. Is there a way I can auto accept this?
The documentation is here: Venmo payments
I work at Braintree, same company as Venmo. If you have more questions, you can always reach out to the Venmo support team.
That error occurs when you don't have a default funding source set, and the only funding source available is your credit card. Setting any default funding source (card or otherwise) will fix the problem. Its purpose is to prevent you accidentally incurring fees.
Thanks for reporting the undocumented error, we'll add it. We'll also update the error message to be more clear.