Multiple subscriptions on same Instagram realtime update - real-time

I have implemented handling subscription notifications for user media updates and it works really great. However, I cannot find a way having two subscriptions of the same type at the same time, e.g. user media updates.
Setting up a subscription is straight forward:
curl -F 'client_id=CLIENT-ID' \
-F 'client_secret=CLIENT-SECRET' \
-F 'object=user' \
-F 'aspect=media' \
-F 'verify_token=myVerifyToken' \
-F 'callback_url=http://YOUR-CALLBACK/URL' \
https://api.instagram.com/v1/subscriptions
I would like to find a solution that can publish subscription notifications to both production environment AND test environment as well. But calling the above in sequence, with one for production and one for test will only keep the last subscription.
Production: www.myservice.com/instagramcallback
Test: www.test.myservice.com/instagramcallback
Instagram real-time photo updates: https://instagram.com/developer/realtime/
EDIT
Instagram does not publish to more than one subscription.

Related

Accessing another repository from within GitHub Actions without using PAT

Within a GitHub Actions workflow in repository A we are trying to download release assets from another private repository B. Therefore the runner (running in a workflow in repo A) needs to authenticate against repository B.
There seem to be 2 possible solutions for that:
Create a private access token (PAT)
Create a GitHub application and use that for authenticating
Since we do not want this setup to be dependent on individual users, option 1) seems like the wrong approach. But we somehow got stuck with option 2). What we did so far:
Create a GitHub application (not oauth, since it should be independent of the user)
Grant all permissions for repositories to this app
Install the app in our organisation
Generate an app private key and create a JWT token following the documentation here
Sending a curl request with this generated JWT token, like
curl -i -X POST \
-H "Authorization: Bearer YOUR_JWT" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/app/installations/:installation_id/access_tokens
But this request always gives us a 401.
So first question is: are we on the right track here? Second question would be: how can we make this work?
It also puzzles us that we would have to re-create the JWT token with every workflow run (since we cannot use a long enough expiration time), and would rather like to have something that can be put into the secrets store of the workflow.

Deploy branch on Heroku via API [duplicate]

This question already has answers here:
Redeploy Heroku app without code changes
(7 answers)
Closed 4 years ago.
I have an application set up on heroku that is automatically deployed via GitHub. That setup is great and I don't want to change anything.
There is a use case now where I need to deploy the application from time to time without code changes (the build process fetches some recent data).
I can easily redeploy an app by going to the user interface and clicking "deploy a branch". However I would love to do this via an API. I could not find anything that helped achieve this in the Heroku Platform API Documentation.
I can create a Deployment via the GitHub deployment API but that doesn't seem to trigger a deployment on Heroku.
Any leads on how I can trigger a deployment for a specific app on Heroku?
Edit: I can't really make use of the answer Redeploy Heroku app without code changes as there is no answer that offers this functionality via an HTTP API.
Heroku doesn't currently have a public API for GitHub Sync. So you will need to use their Platform API to create a build.
GitHub gives you a tar.gz under the URL https://github.com/<organization>/<repository>/archive/master.zip (you need to pass an authorization token in the headers of course).
Using curl, you can do the following:
curl -n -v https://github.com/<organization>/<repository>/archive/master.zip
That URL will be a redirection to a URL on GitHub authenticated to allow the download. Reuse that URL to create an Heroku build:
curl -n -X POST https://api.heroku.com/apps/<app name>/builds \
-d '{
"source_blob": {
"url": "<the URL fetched before>",
"version": "<the version of the code you're trying to deploy>"
}
}' \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.heroku+json; version=3"
That will trigger a new build, downloading the code from GitHub. Effectively doing the same as GitHub Sync internally does.
You can also see this tutorial: https://devcenter.heroku.com/articles/build-and-release-using-the-api

Paypal - RestAPI - Sandbox Webhook not occurring

Using my sandbox account with the RestAPI, I've created an invoice. My buyer account got the notification, I went to the link and paid it ok. There's notifications that I received payment. However, no WebHook notification.
I added all events to my WebHook. When using the WebHook simulator, I get the POST to my API just fine. It's hosted by a Redmond based cloud provider and is https.
Under the WebHook Events link in the Sandbox section, it's showing no entries.
Where else can I go to investigate this?
list all your registered webhooks use following with your actual access-token
curl -v -X GET https://api.sandbox.paypal.com/v1/notifications/webhooks \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer <Access-Token>'
in the response, you should be able to find out what exactly were in the system for your webhooks, if not, did you created the webhooks as document says?
curl -v POST https://api.sandbox.paypal.com/v1/notifications/webhooks \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer <Access-Token>' \
-d '{
"url": "https://www.yeowza.com/paypal_webhook",
"event_types": [
{
"name": "PAYMENT.AUTHORIZATION.CREATED"
},
{
"name": "PAYMENT.AUTHORIZATION.VOIDED"
}
]
}'
From what I see on the RestAPI documentation azlankasim is correct saying that only some fundings are supported.
On the bottom of the page it says that only PayPal authorizations are supported.
https://developer.paypal.com/docs/integration/direct/rest-webhooks-overview/
"Note: Only PayPal authorizations are currently supported. Direct credit card transactions are not yet supported. We are actively working on adding more event types."
Have you tried to test using PayPal payment, to check if this is the problem?
You may need to check what are the funding sources used to create the payment. Currently webhook only sends the notification if the customer pays with an echeck. So far there are no notifications sent if the payment is made with other funding sources. Also, you may need to check the events that you have chosen. Based on this documentation , only authorizations are currently supported.

Is it possible to share Facebook Test users between test apps?

We have seperate URLs for our webapp on local development and on build servers (acceptance test environment) This means that we have to setup 2 seperate Test Apps for Local and Acceptance Test.
When creating test users it seems they can only be created to be valid on only 1 test app... and I have not been able to find a way to share test users between test apps. Not being able to do this makes automated acceptanse testing a pain... as we have to have seperate testdata for Local testing and acceptance testing.
Would love to hear any suggestions on how to solve this easily?
Simple example with curl (its not possible to do it from the Dashboard)
Copy
curl -i -X GET \
"https://graph.facebook.com/v2.9/SOURCE_APP_ID/accounts/test-users?access_token=SOURCE_APP_ACCESS_TOKEN"
Paste
curl -i -X POST \
-d "uid=TEST_USER_ID" \
-d "owner_access_token=SOURCE_APP_ACCESS_TOKEN" \
-d "access_token=TARGET_APP_ACCESS_TOKEN" \
"https://graph.facebook.com/v2.9/TARGET_APP_ID/accounts/test-users"
Afaik you can only create test users for one App, but you can also create them with the API as it is explained in the Facebook docs: https://developers.facebook.com/docs/apps/test-users
Direct link to example code: https://developers.facebook.com/docs/graph-api/reference/v2.2/app/accounts/test-users
Create a test user and then use the API to connect the user to the second app.

daily post to application users wall

i want to post daily note to facebook user profile which using my facebook application via it's own. how can i do it?
Since you didn't provide what language or what you've tried so far, these are quick tips to get you started:
Ask for the publish_stream permission
Then using your SDK or the technology you are using (source):
curl -F 'access_token=...' \
-F 'subject=This is a note' \
-F 'message=Test note.' \
https://graph.facebook.com/PROFILE_ID/notes
No need for the access_token parameter.