I am familiar with Discord Api and I handling requests using a Bot.
However, I need now just to get my user messages (not a bot), and handle the corresponding events.
I am using discord .net but I am not able to find a clear example for this task, that should be simple...
For a bot, I need to create an application in the dev portal. Do I need the same if I just want it for my user?
Discord gateway https://discord.com/developers/docs/topics/gateway is the best option I guess. This example uses javascript with websockets, and no other configuration is required beside the auth token of the guild: https://www.youtube.com/watch?v=uo7ugT_XQKk
Any example about how to read the own user messages in C#?
Related
Does anyone know how I can send an email via my webserver (Azure Functions) to gmail?
This is for clients to contact us through a website so it needs to be frictionless and without a challenge.
I have followed this guide
https://developers.google.com/gmail/api/quickstart/dotnet?authuser=1
After creating my own implementation of IDataStore for Azure, I have painfully realised that this will try to challenge via the web browser.
We previously had this working using SMTP using similar method to this
How to send email by using MailKit?
but this requires us to set the 'Allow Un-secure Apps' flag which after a period of time automatically switches off and causes our contact us page to stop working.
I guess this should be possible using an API key which I have created but I can't find any documentation on how to send an email using just the API Key.
Gmail api route using google .net client library.
If you are using a gsuite domain email address then you can use a service account. Let me know if you need some code for this.
Otherwise you will need to run your code once locally authorize it stave the refresh token then set up your Idatastore to use the refresh token that you pass to it. As long as the refresh token is used regularly it shouldnt expire. Thats not saying it cant but it shouldnt it will need to be babysat a little if it fails just generate a new refresh token for it and it will be up and running again.
smtp route
if you want to use smtp your probably going to have to work out Xoauth2 I am not aware of anything out of the box for C# that works with that and the Google .net client library does not work with the smpt server.
Since the existing instagram APIs are deprecated, I am switching to the graph api.
Below is what i want to achieve and what the issue is.
Requirement.
I would like to track the number of likes and comments on instagram posts in which my business account is mentioned using #. I have setup the faccebook and instagram accounts along with the webhook. The webhook is going to send me the "mediaid" in which i my business account is tagged.
Since the app is in the development mode i am not receiving the webhooks if i mention the business account in any of the post, but i am able to send the test webhook from the developer account console. So i assume once the app is in LIVE mode it will start sending the webhooks to my server.
Once the "mediaid" is received i would like to make a call to another api https://developers.facebook.com/docs/instagram-api/reference/user/mentioned_media
in order to get the number of likes and comments.
I am facing an issue on the 2nd part. Whenever i call the api mentioned in the 2nd part i am getting the error
This api call works fine when i pass the mediaid that my instagram business account owns. But as soon as i pass the mediaid of the post which mentioned my business i am getting the above error.
I just wanted to check if this is also a limitation of my facebook app being in a development mode ? Please suggest a solution to achieve this scenario.
I tried the same what you did but with a live facebook app. From the webhook, I got an event when any other user mentioned my instagram business handle in caption and am able to fetch the mentioned media details using the mentioned media API https://developers.facebook.com/docs/instagram-api/reference/user/mentioned_media.
As you didn't share the webhook event payload, I am just assuming you are using the correct user id while making the API call. The JSON path of the user id in event payload is entry[0].id
I am Currently working on a Discord Bot for my Twitch Channel. This is the first use of C# I have had so I am learning on the way.(I have had prior experience in C and C++.)
The Bot currently will run into the Discord server and when I type a command it will return what I have set it to return.
The next thing that I am wanting to implement is a Twitch Alert in the Announcement Channel that will alert the channel when my channel goes live. I am just getting any where on how to implement the Twitch API so that I can check for the event of me going online.
My question is: How do I connect to the Twitch channel so that I can look for an event indicating the channel has gone Live?
Did you read the twitch api documentation or even search for this yourself? I have no idea about twitch or what they provide for api integrations and i figured this out with 5 minutes of googling.
Twitch has no plan to support webhooks, as mentioned here. Which means you'll have to poll for it (check the streams api to see if a channel is live or not, maybe every minute or so depending on how accurate you want it to be).
Their developer api will talk about how to determine if a channel is live or not - specifically the streams api that lives here.
To summarise what it says there, what you should send a query to the url like the following:
https://api.twitch.tv/kraken/streams/[CHANNEL_ID]
Replacing CHANNEL_ID with the id of the channel you're interested in, and including your developer client id in the headers of the request. (more on this in the docs page i linked)
It will return null if the channel is offline, or a stream object if they are streaming.
When you make this request, you will need to check if the new value is different than the last value that you received when you queried before - if so, the channel state (live/offline) has changed and you should post a message to your discord channel.
I'm not going to code it for you, but you should be able to figure this out now. Search up on how to send a HTTP request, and how to add a custom http header (for the twitch client id header), how to parse JSON etc.
As far as I know, when I developed a console app using YoutubeAPI to create live events for streaming, youtube required me to choose the account which was enable live streaming to put live events on.
But when I developed a website app using that API, even though I opened icognito browser to create live events, it still used my first account in Chrome to create live event.
I wondered if there is some way to make this API to select user like what happened in console app.
I think it is because of the client_secrets.json but I don't know how to fix it.
I am using C# to develop
All of the Live Streaming endpoints require OAuth, you must be authenticated as the user you wish to stream live with. You cannot stream on another user's behalf unless they have logged in and provided a valid OAuth token to use for your requests.
I want to programmatically login and access the data in Google SMS channels using C#. Eg. I want to retrieve data from http://labs.google.co.in/smschannels/channel/wordoftheday. How do I go about it. I looked at Google ClientLogin, but am unable to get it working.
CodeGlobe has an article about how to programmatically login to way2sms.com and send an SMS message. You may be able to use the same technique for the Google SMS channel. I haven't tried this, but it may help you.
Here is the full article on sending SMS messages using C# with way2sms: http://codeglobe.blogspot.com/2010/02/way2sms-send-sms-c-code.html
Well Its been a long time the question has been asked, but anyway google sms channel does not have an api so you wont be able to get the feeds programmatically but if you know the account user you can ask him for rss feeds and parse them using .NET or something.
There is no other way, but you know i hacked around google sms channels to send sms programmatically i just keep updating a .xml file and all the people subscribed to my channel get the sms.