I’m having some trouble with getting my zapier REST Hook subscribe working. The Authentication setup is working.
I receive the POST subscribe from zapier with the “target_url,event” data. As soon as I POST any data to the “target_url” for some reason the unsubscribe url is then called which disables the “target_url”. So every attempt to POST or GET to the “target_url” just responds with “please unsubscribe me!”. Any help would be appreciated
Zapier Subscribe Post Respone
{
"subscription_url": "https://hooks.zapier.com/hooks/standard/2954661/d9bd6b7a323747628ee4cb6102a15056/",
"target_url": "https://hooks.zapier.com/hooks/standard/2954661/d9bd6b7a323747628ee4cb6102a15056/",
"event": "get_contact"
}
Zapier Post Header Response
{
"host": "messagebot.ngrok.io",
"x-hook-test": "true",
"accept-encoding": "gzip, deflate",
"content-length": "228",
"accept": "application/json",
"user-agent": "Zapier",
"content-type": "application/json; charset=utf-8",
"authorization": "Basic NTcyOGUxOTU1OTUzZmEzMmUwNTliMGNmOg==",
"x-newrelic-id": "VgMAVF9bGwIHVVRQBwMA",
"x-newrelic-transaction": "PxRRUVQBDQNRXFEHAwJWXwEBFB8EBw8RVU4aBAgKVgcDBAFRVFUAA11TB0NKQQsLAVZXV1ZUFTs=",
"x-forwarded-for": "35.168.226.6"
}
Post Data To Zapier target_url
[{
"first_name": "Jim",
"last_name": "Bozack",
"tag_1": "DTW010517A",
"event": "get_contact",
"email": "testing#fakeemail.come"
}]
Response from Zapier target_url
{
"status": "success",
"attempt": "5a85c059-19c0-4129-a44f-79be9f8ea270",
"id": "10593f34-d7a2-4cdd-b805-6da0d8ace9eb",
"request_id": "5a85c059-19c0-4129-a44f-79be9f8ea270"
}
After the response from the "target_url" the unsubscribe is called.
Hope this helps someone. I spent way to long on this.
When you are testing your Zap will be automatically put in "Off" mode. As I learned that any Zap that is "Off" will automatically "delete/unsubscribe" a subscribe. But when you turn the Zap to "On" the POST subscribe will be triggered again with a "target_url" that is usable.
From the Zapier documentation it looks like you are supposed to return a 201 to confirm receipt of the subscription. This may be needed to confirm registration on the remote server.
You can do this with:
http_response_code(201)
I realize this is assuming that you are working with PHP, but your development environment is unspecified. Does this apply?
Related
I am trying to send messages through yammer POST API from the server side -> "https://www.yammer.com/api/v1/messages.json"
with headers -> "Authorization" : "Bearer #authToken".
and with body ->
{
"body": "This is a Spot Award",
"group_id": "$Group_id",
"skip_body_notifications": "true",
"is_rich_text": "true",
"message_type": "announcement",
"title": "Spot Award",
"og_description": "Monetary Award",
"og_private":"private"
}
But it posts against my user name and I want to send it against my organisation's name. And this is happening due to the #authToken which is generated with user/Application Combination.
How can I send posts against my Organisation's name to any groups?
I am new to Robot Framework and am facing an issue while sending query params in Get Request method.
Following is the code that I tried with no luck :
Get Data With Filter
[Arguments] ${type} ${filter}
${auth} = Create List ${user_name} ${password}
${params} = Create Dictionary type=${type} filter=${filter}
Create Session testingapi url=${some_host_name} auth=${auth}
${resp} = Get Request testingapi /foo/data params=${params}
Log ${resp}
${type} has value new and ${filter} that I want is id:"1234"
I am expecting final url to formed as :
/foo/data?type=new&filter=id%3A1234
Instead of forming the expected url, I get the request url as :
GET Request using : uri=/foo/data, params={'type': 'new', 'filter': 'id:1234'}
I might be missing something very obvious but I cant figure out what it is. What can I change in this piece of code or any new code that needs to be added?
I think the logger is just outputting the params as the dictionary. The request should actually be made to foo/data?type=new&filter=id%3A1234
You can test it with the following request to Postman Echo (An HTTP testing service):
${auth} = Create List Mark SuperSecret
${params} = Create Dictionary type=Condos filter=2Bedrooms
Create Session testingapi url=http://postman-echo.com auth=${auth}
${resp} = Get Request testingapi /get params=${params}
${json} = To JSON ${resp.content} pretty_print=True
Log \n${json} console=yes
The response will correctly list the params you've encoded:
{
"args": {
"filter": "2Bedrooms",
"type": "Condos"
},
"headers": {
"accept": "*/*",
"accept-encoding": "gzip, deflate",
"authorization": "Basic TWFyazpTdXBlclNlY3JldA==",
"host": "postman-echo.com",
"user-agent": "python-requests/2.25.0",
"x-amzn-trace-id": "Root=1-5fb43ae9-1880b0a621c864b06ce1f54a",
"x-forwarded-port": "80",
"x-forwarded-proto": "http"
},
"url": "http://postman-echo.com/get?type=Condos&filter=2Bedrooms"
}
I am using Advanced REST Client tool to test a data pull from the Keen IO API, and think getting the request right, but not getting the data. Getting "resource not found" error. This can also be done via CURL.
Headers: Authorization:
Content-Type: application/json
actual request: GET /3.0/projects//queries/saved/Sponsorships/result HTTP/1.1
HOST: api.keen.io
authorization:
content-type: application/json
Base URL used: https://api.keen.io
Any ideas as to what may be doing wrong?
The saved query name is capitalized "Sponsorships". Make sure your saved query name is lower-cased, not camel or title-cased. To be sure that you are getting the correct saved query name.
Also, you may want to first obtain a list of all saved queries as a reference:
GET /3.0/projects/<project_name>/queries/saved HTTP/1.1
HOST: api.keen.io
authorization: <your_key>
content-type: application/json
You will get something like this:
[
{
"refresh_rate": 0,
"last_modified_date": "2016-12-20T01:09:54.355000+00:00",
"query_name": "",
"created_date": "2016-12-20T01:09:54.355000+00:00",
"query": {
"filters": [],
"latest": 100,
"analysis_type": "extraction",
"timezone": "UTC",
"timeframe": "this_30_days",
"event_collection": ""
},
"metadata": {
"visualization": {
"chart_type": "table"
},
"display_name": ""
},
"run_information": null
}
]
FWIW, I also have seen the "Resource not found" error when writing data to an event if the project is not correctly set up. For example, passing in the wrong project_id or write_key or if the project was deleted from your Keen.io account.
By following the guide on https://developer.paypal.com/webapps/developer/docs/integration/web/accept-paypal-payment/ , I have successfully created a payment and redirect the user to approve it.
The created payment is something look like bellow, and I save it in user's session for further reference.
{
"id": "PAY-6RV70583SB702805EKEYSZ6Y",
"create_time": "2013-03-01T22:34:35Z",
"update_time": "2013-03-01T22:34:36Z",
"state": "created",
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"transactions": [
{
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"subtotal": "7.47"
}
},
"description": "This is the payment transaction description."
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-6RV70583SB702805EKEYSZ6Y",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=EC-60U79048BN7719609",
"rel": "approval_url",
"method": "REDIRECT"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-6RV70583SB702805EKEYSZ6Y/execute",
"rel": "execute",
"method": "POST"
}
]
}
After user approved the payment, Paypal will redirect the user to the return_url. For example, http://<return_url>?token=EC-60U79048BN7719609&PayerID=7E7MGXCWTTKK2.
In order to execute the payment, a POST request has to made to https://api.sandbox.paypal.com/v1/payments/payment/{payment_id}/execute/.
Question
The only two pieces of information provided from Paypal in the URL is token and PayerID. How can I find the corresponding payment_id?
Possible Solution
The token is part of the approval_url, parse the URL and store the token -> payment relationship can solve the problem. But I'm looking for a better solution that doesn't require parsing.
I think the paypal documentation isn't clear about this. But you can do something simple to resolve your problem passing de PaymentID through a parameter in your return url.
Like this:
return_url = 'http://www.yourdomain.com/paypal/success/?paymentID=PAY-1234567'
When the Paypal redirect to your site, then, it will return the paymentID together with the other parameters.
You would have to remember the Payment ID on your side (typically attached with your user session - shopping cart or order or as a session cookie) before redirecting the user to PayPal approval url. Once the is redirected back to your return Url along with the PayerID - you would need to extract the PaymentID from your user session and execute the Payment.
The Payment Id can be obtained in PHP by using the following method after the first API request has returned a successful response:
$payment->getId();
The online code sample (http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/CreatePaymentUsingPayPal.html) shows how to send the request, however it does not include the getId() method.
To find this out I had to look in the downloaded SDK files at the file sample\payments\CreatePayment.php which has the following example code showing the use of this method:
ResultPrinter::printResult('Create Payment Using Credit Card', 'Payment', $payment->getId(), $request, $payment);
I found this link to be extremely helpful, in case anyone wants to check it out: https://github.com/paypal/PayPal-NET-SDK/issues/79
Since the v1/payments API has been deprecated for some time now, the best solution is to use the current v2/checkout/orders API for all new integrations. The order ID is returned in the URL.
However, redirects are an old integration method, for old websites. It is preferred to not use any redirects, at all, and keep your site loaded at ALL times. Instead use this approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
paymentid:
After you created the payment, in return json, you can get paymentid.
like this: "id":"PAY-01K00482KX842131HKORKVKY"
payerid:
you can use API:GET /v1/payments/payment/{paymentId} to get payer id after user approved the payment,and you will find payerid in return json,like this:
{
"id":"PAY-01K00482KX842131HKORKVKY",
"create_time":"2014-06-19T09:17:31Z",
"update_time":"2014-06-19T09:17:31Z",
"state":"created",
"intent":"sale",
"payer":{
"payment_method":"paypal",
"payer_info":{
"email":"buyer#samsung.com",
"first_name":"buyer",
"last_name":"samsung",
"payer_id":"H2DKRTTYWW8HS",
"shipping_address":{ "line1":"Lushan Road Num.188", "line2":"JianYe",
"city":"Tucson",
"state":"AZ",
"postal_code":"85715",
"country_code":"US",
"recipientName":"buyer samsung"}}},
"transactions":[{
"amount":{
"total":"12.00",
"currency":"USD",
"details"{"subtotal":"12.00"}},
"description":"creating a payment"}],
"links":[
{"href":"xxxxxxx","rel":"self","method":"GET"},
{"href":"xxxxxxx","rel":"approval_url","method":"REDIRECT"},
{"href":"xxxxxxx","rel":"execute","method":"POST"}]}
I'm having some difficulty implementing paypal implicit payments and unfortunately there is very limited details in the error message response from paypal.
Here's the request:
{
"actionType": "PAY",
"currencyCode": "USD",
"cancelUrl": "http://my_domain.com/cancel_url",
"returnUrl": "http://my_domain.com/return_url",
"requestEnvelope.errorLanguage": "en_US",
"requestEnvelope.detailLevel": "ReturnAll",
"senderEmail": "sender#email.com",
"receiverList.receiver(0).amount": 50,
"receiverList.receiver(0).email": "receiver#email.com"
}
Here's the headers i'm setting:
"Content-Type", "application/json"
"Accept-Language", "en_US"
"X-PAYPAL-SECURITY-USERID", "username"
"X-PAYPAL-SECURITY-PASSWORD", "pwd"
"X-PAYPAL-SECURITY-SIGNATURE", "sig"
"X-PAYPAL-APPLICATION-ID", "My App id"
"X-PAYPAL-REQUEST-DATA-FORMAT", "JSON"
"X-PAYPAL-RESPONSE-DATA-FORMAT", "JSON"
Here's the response:
{
"responseEnvelope":{
"timestamp":"2013-04-06T12:02:41.011-07:00",
"ack":"Failure",
"correlationId":"3842d361b077d",
"build":"5563463"},"error":[{
"errorId":"580001",
"domain":"PLATFORM",
"subdomain":"Application",
"severity":"Error",
"category":"Application",
"message":"Invalid request: {0}"
}]
}
I just had the exact same problem and couldn't find the answer anywhere. Turns out I was using a GET request instead of POST. It's odd though that the errorId 580001 is nowhere to be found in their docs.
The adaptive payments API doesn't accept whitespace in the request payload, remove all the spaces and newlines and give it another try. Took me ages to figure that out.
Another thing to look out for is encoding. I've had this error and realised that it was due to an ampersand in the "memo" field. If you send the request as NVP be sure to URL encode where possible.
let payload={
"actionType":"PAY",
"currencyCode":"USD",
"receiverList":{
"receiver":[{
"amount":1.00,
"email":"buyer email"
}]
},
"returnUrl":"succes url",
"cancelUrl":"cancel url",
"requestEnvelope":{
"errorLanguage":"en_US",
"detailLevel":"ReturnAll"
}
}
let url = "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay";
return this.http.post(url, payload, { headers: headers })
headers.append('X-PAYPAL-SECURITY-USERID', 'security id');
headers.append('X-PAYPAL-SECURITY-PASSWORD', 'password');
headers.append('X-PAYPAL-SECURITY-SIGNATURE', 'signature');
headers.append('X-PAYPAL-REQUEST-DATA-FORMAT', 'JSON');
headers.append('X-PAYPAL-RESPONSE-DATA-FORMAT', 'JSON');
headers.append('X-PAYPAL-APPLICATION-ID', 'APP-id');
As another cause of this issue, make sure the amount property for each receiver does not contain a comma, as this will also break. I.e. 1000.00 instead of 1,000.00.