Where to add payload URL for Twitter webhook? - twitter

Github has a webhooks tab in the settings of a repository and it has a submission for a payload URL. I looked all over the developer site for Twitter but I can't really find anything. I'm still really new to how all of this works.

For Twitter, you need to add your webhook URLs programmatically via the API. The documentation is here. You'll need to send an authenticated HTTP POST request to https://api.twitter.com/1.1/account_activity/all/[YOUR_ENV_NAME]/webhooks.json with the URL specified in the URL parameter.
If you would like something that does more of the work for you - although this is in JavaScript, not Python - you can take a look at this tutorial using autohook.

Related

Twitter API: How Do I Create a Protocol Only Callback URL?

In Twitter's Developer Documentation we can read the following:
Mobile apps with app-specific protocols must use just the protocol
Example:
You want to use example://authorize as your callback URL
Add this to both your Twitter app dashboard and your call to oauth/request_token: example://
However; in the Developer's Dashboard I am not able to enter a protocol only URL, or any URL beginning with other than http or https.
My reason for wanting a protocol only URL is so that I can use in an iOS app that uses OAuthSwift to access web APIs.
Any ideas anybody?
I haven't found the answer to the original question but I do have an excellent work around. So, for anyone else who might land here:
The web app at https://oauthswift.herokuapp.com/callback
will perform redirections. If you access that web site with the url https://oauthswift.herokuapp.com/callback/target then it will redirect to oauth-swift://oauth-callback/target.
So:
In the Twitter Dashboard enter https://oauthswift.herokuapp.com/callback/SomeName for your app's callback URL
Register oauth-swift as a URL scheme in your iOS app's URL Types
In your iOS app, use https://oauthswift.herokuapp.com/callback/SomeName as the callback URL for the OAuth authorization request.
Voila. Twitter will redirect to https://oauthswift.herokuapp.com/callback/SomeName which will in turn redirect to oauth-swift://oauth-callback/SomeName, allowing your iOS app to regain control of the flow.
If you find any of this confusing then this might help: http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

Redirect command requests to another service

I have a not yet published app change in Slack which modifies the command service endpoint to another domain.
I tested that, it is possible to send back a 307 with a redirect URL and Slack API will follow that redirect.
I would like to be sure that redirect to another domain is also possible for live apps. So what works for an in-development app it will work for a live app.
Could any of you confirm that or send me a link to the documentation? I searched the documentation already, but did not find any entry about it.
Thanks!
We contacted Slack on their partner channel and they verified that:
"Our docs explicitly say we respect 301 and 302."
But we made a test and it accepts 307 as well.
(I can't share a link to their response as it was written inside Slack slack-platform workspace)

Callback URL not approved by Twitter

My application built upon spring-social-twitter that enables users to sign in with Twitter has stopped working recently.
I've got an error message as below:
Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings
Note: I'm using Spring Social Twitter version 1.1.2.RELEASE. And if you use Spring Social Twitter version 1.1.0.RELEASE, you might get a slightly different error message as below:
POST request for "https://api.twitter.com/oauth/request_token" resulted in 403 (Forbidden); invoking error handler
Twitter recently (in May 2018) enforced that sign-in-with-Twitter users must whitelist callback URLs for security reasons (see the announcement).
This means callback URLs have to be explicitly and identically set up for all supported third-party applications. You can setup the callback URLs in your Twitter's application setup page: https://apps.twitter.com
For example, if your callback URL is http://localhost:8080/myApp/signin/twitter, you must add it to the list of Callback URLs in your Twitter's application setup page exactly as it is: http://localhost:8080/myApp/signin/twitter
See also the documentation on Twitter callback URLs.
I struggled with this since Twitter made the changes to increase security. My android app would use a callback URL and the same URL in the Intent Filter. But since the change, the URL I was using had to be registered in the Twitter developer portal. I was using ouath://myapp, but Twitter does not accept that as a valid URL (website).
After a bit of digging, I found that for apps you can specify any scheme but only as a scheme. For example I used myapp:// as the callback URL.
In my app, my callback URL was myapp://whatever, and in the Intent filter, I used :
<data android:scheme="myapp" android:host="whatever">
Twitter accepted the callback URL and it correctly redirected back to my app after the user authenticated with their Twitter credentials.
I has originally used just a normal website, and that worked too, but after validation by Twitter, it asked if I wanted to redirect to My App, or to a Chrome browser. Using the above approach it will simply return to your app.
After I did all this, I realized that I could have just added Oauth:// as a call back URL and my app would have worked without change.
I fixed it by adding those callback URLs to Twitter's whitelist.
twitterkit-{Twitter API Key}:// for iOS.
twittersdk:// for Android.

iOS - Venmo API integration: Web Redirect URL

I'm trying to register my App on Venmo's developer site so that I can properly use their API, but I'm stuck trying to figure out what the required "Web Redirect URL" field is for. According to the docs, it says it is the following:
Venmo will redirect your users to this address. Must be formatted like
http(s)://www.example.com/example_redirect_url
As far as I could gather this was a URL scheme that would allow Venmo to redirect you back to your app after payment processing was completed on their side, but in researching how to set up a URL scheme the format is something like "[scheme-name]://", not "http://...."
The other thought I had was that this was just a url that contained a server-side or javascript redirect to that aforementioned URL scheme, but that seems like an unnecessary extra step. I also have a few other theories on what it could be, so I'm really just not sure which one it is...
I was running into the same problem. If your website is deployed you can use the redirect that your hosting service provides you. If you're not deployed then you can set it localhost.
Example: http://localhost:8000/auth/venmo/callback

How To Build an API URL using Postman Chrome extension

Currently interning in a mobile dev company.
Working on a task that they assigned to me.
Need to build an explore screen that receives JSON data.
They have their JSON data coming through Postman chrome extension.
I have authorization token and sample username/password.
As well as something that looks like a link that I can modify:
https://nameoftheapp.nameofthecompany.com/api/v1/search/surveys/app?searchCategory=explore&limit=10&offset=0&location=global
All iOS json tutorials shows that I need an API url.
How Can I build such URL?
edit:
here is what I've been given - the Postman chrome extension:
(sorry, had to hide some details because of non disclosure agreement)
Postman assist you in testing the functionality you have built into an API. These functionalities can be accessed by typing in the URL and then using the GET, POST, PUT etc HTTP requests.
I think maybe this video can assist you in learning more about Postman - Javabrains does a great job at explaining it:
http://javabrains.koushik.org/courses/javaee_jaxrs/lessons/Installing-A-Rest-Api-Client

Resources