Zapier Rest Hook Subscription
Asked Answered
T

2

5

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": "[email protected]" }]

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.

Tybalt answered 15/2, 2018 at 15:32 Comment(3)
Can you provide examples of the POST received, including the target_url value, and the exact response?Sora
I added the POST data received as well as the header info. If I send any POST or GET to the target_url Zapier will response with success message. But at the same time an "unsubscribe" is called which then kills the target_url.Tybalt
Yes, this is Zapier default behavior when we turned off Zap the unsubscribe event called. And when we turned On Zap again then zapier calls a Subscribe event. During testing, Zapier call subscribes event and then call a unsubscribe event to stop webhook delivery. So the result the webhook eneble only when the Zap is ON.Proprietor
T
5

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.

Tybalt answered 15/2, 2018 at 23:27 Comment(0)
S
1

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?

Sora answered 15/2, 2018 at 16:46 Comment(2)
I'm getting the same results event with adding the "event". From the docs it looks like the "event" example is from Zapier sending to my app. I've also updated and added some more info.Tybalt
Thanks for your help, but ended up being my zap was off.Tybalt

© 2022 - 2024 — McMap. All rights reserved.