How to get an existing webhook (parse from json) from Calendly? - c#

I am new to StackOverflow, struggling to find a solution to my problem: I am trying to synchornize my asp.net app with the calendly api.
So far, I have managed to create a webhook subscription and I saw that the webhooks are being registered to https://calendly.com/api/v1/hooks/ and I was able to acces a specific webhook using its id (I used Postman to see all this, as I am currently local developing). I am having a lot of trouble since I am not able to understand what call should I make in order to get the webhooks and be able to use their data in my app.
https://developer.calendly.com/docs/sample-webhook-data
This is what I should be parsing, according to Calendly documentation.
I want to get data such as the emails of those participing into the event, also the date and status of the event. How can I do this?

From your question, it seems to me there might be a lack of conceptual understanding of what webhooks are.
As you mention, you had already subscribed to be notified if some event happens in Calendly (I assume invitee.created event).
This means, that
when this event actually happens on Calendly (you may need to make a test scheduling request in the Calendly UI), the notification about this event is sent to the URL you had registered (subscribed).
This registered URL has to be reachable for the notification call. In other words, if the URL is in your local environment (and you mentioned it is so), it's impossible for the notification to reach the registered (subscribed) destination. So this might be the issue you're experiencing.
You need to read incoming raw data. In my script, with PHP, I do it using file_get_contents('php://input')
You need to parse the data. With PHP I use json_decode($inputData). In your language you've got to use whatever tools you have for JSON parsing.
Basically, that's it. In my case, I read invitee email using $parsedData->payload->invitee->email.
Hope it helps.

Related

Firing hCaptcha callback function for bypass token

I'm trying to bypass the hCaptcha in Discord Account Registration using selenium webDriver in C#. I'm using CapMonster Cloud API for solving the captcha itself and as response I'm getting bypass token.
The problem that I currently have is that I can't locate the callback function that I need to call/submit, in order to pass the hCaptcha.
I'm setting the bypass token into "g-recaptcha-response" and "h-captcha-response" textareas, but can't find a way to locate and call the callback function. There is no form to be submitted.
using selenium webDriver in C#
10/10 Would recommend doing discord captcha bypasses using:
PuppeteerExtraSharp/ExtraStealth
(as selenium has some obvious tracers)
Puppeteer has a lot more freedom in it's API as well as the fact that 2capthca is a much more popular method for solving h-captchas
I know this doesn't answer your question but i hope you look into this as a potential better alternative if you do not receive a more traditional answer.
You can do that with Anti-Captcha.com plugin which will do the job automatically. It injects its own callbacks, so when a token is ready it submits the form. If you ever have problems with plugin, support guys here will help you out.
Web communication has to happen in one of the methods defined on this page
So if anything is being sent and received from a server to the browser it has to be one among those methods. Generally the most common methods are POST and GET.
The statement "There is no form to be submitted" is somewhat confusing. A form is just display of fields to collect data from a user. In case a website does not need user input they do not show the form. They would instead capture the required data and send a POST request to the server (without the user ever noticing), in a manner similar to how a form would have sent the data. This is a normal behavior for almost all major websites. An example is google-analytics codes.
So what you need to look for is a POST request (mostly or PUT maybe GET - depends) where the data you are targeting is received or sent.
In your case there indeed is a form which displays the captcha (that is how you see it) and and associated POST request which does what you need.
Url for the post request on the captcha is POST /getcaptcha?s=xxxxxxxx-xxxe-xxxx-xxxx-xxxxxxxxxxxx HTTP/3
Url where it is sent is POST /api/v9/auth/register HTTP/3
These basics apply to any web communication and not just the website in question.

How do I provide dynamic twiml instrucions in an outbound call in C#?

I'm attempting to use CallResource.Update() in C# to provide dynamic twiml instructions to a call in progress. I'd rather use CallResource.Create(), but it only accepts a twiml url.
I've not been able to find any documentation or examples on how to do this, and the only documentation I can find that even hints at this capability is in the API reference for the Call resource Update method here: https://www.twilio.com/docs/voice/api/call#update-a-call-resource
Where it states:
TwiML instructions for the call Twilio will use without fetching Twiml from url. Twiml and url parameters are mutually exclusive
Essentially what I want to accomplish is the appointment reminder tutorial but with outbound voice calls as opposed to sms messages.
I need the call to say "Hello {Name}, This is {Company}. We have you scheduled for a {Typeof} appointment on {date} at {time}, if you need to reschedule, please call {Number}" All of the above data is in our database.
I've tried a mish-mash of syntax trying to hopefully luck into the correct way of doing this, but haven't yet managed to find a solution outside of twimlets.
I'd rather not have to stage a public webserver or setup free hosting to do this even though it wouldn't contain any propretary info or PII, it's beyond the scope of my knowledge and time-frame to develop this solution.
I can do this via SMS all day long with twilio so I'm developing a decent knowledge and appreciation for the API, but we have clients that arent sms friendly and require voice calls so I need a solution for them.
var from = new PhoneNumber("Insert Valid Twilio nyumber");
var call = CallResource.Create(to,from, url:new uri("http://demo.twilio.com/docs/voice.xml"));
CallResource.update(
method: twilio.http.httpmethod.post,
url: new uri("http://twimlets.com/message?Message%5B0%5D=Testing&")
pathSid: call.Sid);
In testing this, I'm expecting the message to play the demo, and then switch to say the word testing (which I would later like to implement dynamic twiml instead of using twimlets).
What is actually happening though is that I get an exception stating that the call is not in progress when it gets to the call update statement.
So two problems, one, how do I update the call to the new twiml url, and then how do I substitute the url for twiml instructions like the API documentation states that I can.
Any help would be greatly appreciated.
Twilio developer evangelist here.
That's the first time I've seen the twiml parameter for any REST API resource and given that is the only mention of it, my guess is that we are working on this and have let something slip into the documentation by mistake. For that reason, I would not try to use the twiml parameter right now.
For the error that you're getting when you try to create then update a call:
When you create a call there are more steps than the phone starting to ring. After the call resource is created it is in the "Queued" state. Shortly after, Twilio dispatches the call putting into the "Initiated" state, then when the destination starts to ring it goes into the "Ringing" state. You can check the call lifecycle here. Since your code to update the call runs directly after you receive the response the call is likely in the "Queued" state, thus the error.
If you just need the call to read out a message, then I see no problem with using the Message Twimlet as the initial call URL.
If you need something more dynamic without you having to deal with your own hosting, can I recommend taking a look at Twilio Functions.

Twitter Streaming API C#

Hi does anyone know how to use the streaming API for C#? Therefore, whenever there is a new tweet in my account, it will be reflected in my program.
So far the only reliable wrapper I've found for this in .Net land is TweetInvi. Try to ignore that the web site looks like it was designed by a hyperactive 10-year old (thanks MS 'metro' team), the actual library is very well designed and rock solid.
Assuming of course you have the relevant access tokens (if not see http://dev.twitter.com), an example of how easy it is to have up and running:
TwitterCredentials.SetCredentials(userToken,userTokenPrivate,apiKey,apiKeyPrivate);
_userStream = Stream.CreateUserStream();
_userStream.TweetCreatedByFriend += (sender,args) => Console.WriteLine(args.Tweet.Text);
_userStream.Start();
This will write the body of tweets to your console output, and it updates even faster than leaving the actual Twitter web site open. There are other events exposed for when a tweet is favourited, retweeted, when you have a new follower etc.
I can vouch for this library as being reliable - I am using it for my CovertTweeter project and have had absolutely no issues with it. In fact accessing the streaming API through TweetInvi has been even easier than the many brick walls I was left hitting when using REST wrappers like Linq2Twitter and TweetSharp.
Have a look at this post:
Streaming with New .NET HttpClient and HttpCompletionOption.ResponseHeadersRead
You don't have the complete implementation there but you will get the idea.
Here is a sample which "Reads data from the Twitter Streaming API and adds it to MSMQ. A second process (included) reads from the queue, parses the json message, and updates a data store."
https://github.com/swhitley/TwitterStreamClient
You can change the above problem to generate an event when it updates the data store. In your program you can subscribe this event to do whatever you want.
If you are looking for OAuth based sample then please use "AuthPack" which Provides .NET oAuth for Twitter, Facebook, LinkedIn, and Google:
https://github.com/swhitley/AuthPack/tree/master/AuthPack
I have found a good sample code that uses streaming API, here Twitterizer.

Get HTTP headers on WebKit.NET

I've been trying to figure out how to handle 401 responses on WebKit.NET and show an authentication box so that user can enter his credentials and then send them back to the server.
This guy figured a way to add the proper headers to a new request and send them to the server, but seems like the code is sending them to every page that the browser navigates to which is not what I want. I dug a bit into the code and there is this interface called IWebResourceLoadDelegate which among other contains two event handlers called didReceiveResponse and didReceiveContentLength that will be called for every response, but can't figure out how in the world to read the headers from the parameters being passed. I think the header is just not being passed at all.
Also, seems like the guys at web kit sharp haven't solve this issue either, but somehow Chrome does handles it properly. I'm not sure which build of WebKit Chrome uses. I just hope is not a custom build such that I won't have a choice other than spending the rest of my life trying to build WebKit (and the other rest trying to add the missing functionality).
Any one has any idea how could I begin to figure out how to handle this?
I haven't worked on this project in some time, but it looks to me like you should be able to get the request headers from the WebURLResponse object, perhaps from the allHeaderFields or statusCode methods...
It would be really great if you could finish my work to get full HTTP Auth support in WebKit.NET. I just haven't had the time... Chrome and Safari have their own proprietary implementations that do the trick.

Sendgrid Emails - Result handling and tracking

I am looking at the c# .Net libraries from sendgrid to send emails from my applications. I can only see a DeliverAsync method within Web and I don't see any Deliver method as shown in some examples..
1) if I want to know the result of that email(success/Failed/smtp status codes), How and where do I get that information? Is there any result object?
2) if I want to track the status of the email later like whether it sent to spam or user opened it How can I do that. DO they have any tracking number/id for the email which I can get from the result object and use it later to get status through their API?
I am new to using Sendgrid libraries. So any help is appreciated.
Thanks
There's no result object in the sending of the message, since that can take some time.
The best way is to leverage the Event Webhook, so that you can receive POSTs with JSON data about your messages. you can even leverage unique_args to positively relate events to a particular message.
Depending on what you want to do, you might want to try a templating API, like sendwithus. They'll integrate with SendGrid events for you and give a UI showing events and status of every email.

Categories

Resources