0

I am working on a CustomerEngagement solution that is integrated with twitter. Looking for suggestion with implementation.

I have configured multiple twitter-apps with a call back URL for each twitter-app (same callback URL), pointing to the same end point in CustomerEngagement application. I have 2 java methods written, 1 for responding to CRC challenge by twitter(authentication) and 1 for actually receiving the tweet from twitter.

I would like to configure multiple twitter-apps to be served/used by the same single instance of the CustomerEngagement-application from the same endpoint However, the CustomerEngagement application should have a hint about which twitter-app is responsible for posting the tweet to the application, so that CRC response to twitter can be generated accordingly.

Can I pass a different request parameter in each call back URL of different twitter-apps to identify the app?

I already see a conversation on the same https://twittercommunity.com/t/callback-url-with-fixed-query-string-parameters/107821 however, can some one please elaborate on how to achieve this ? I am assuming that this a 2 step process where registering the call back URL ( along with request parameter ) happens to be step 1, followed by setp 2 in which the call back by twitter having the request parameter registered in step 1 is passed !

Thanks in Advance!!

Ravi
  • 21
  • 3
  • Just to clarify here, the CRC functionality is only required by the Account Activity API webhook. What is the purpose of your callback URL - is it to act as a webhook, or is it to perform the server-side piece of the Sign in With Twitter flow? – Andy Piper Dec 10 '18 at 13:32
  • The purpose of the callback URL - is it to act as a webhook. We wanted to implement a single REST end point for listening to multiple call back URLs ( each call back URL is distinguished by the value of a particular parameter passed to the common REST end point ) and respond to the CRC from twitter employing respective consumer_secret. I now figured out that the distinguishing parameter can in-fact be passed as part of call back URL itself (as path param) rather than a separate request parameter. Thanks Andy. – Ravi Dec 26 '18 at 07:21

1 Answers1

0

Say your configured callback_url is xyz.com/social/ append the query strings params when parsing the callback_url
tweepy

import tweepy

auth = tweepy.OAuthHandler(consumer_key, consumer_secret, 'xyz.com/social/?var=val') 
url = auth.get_authorization_url()

You get an authorization URL that redirects to a twitter login page. After login, it returns

xyz.com/social/?var=val&oauth_token=****$oauth_verifier=***

Nifemi Sola-Ojo
  • 851
  • 1
  • 9
  • 8