<p>Turns out this was not a good use case for the Webhooks plugin - which is better suited to blind "shout outs" to other services than "communication" with them.</p>

<p>I created a plugin instead that uses Guzzle to make API calls, and can do some round-trip requests as a result.</p>

CC BY-SA 4.0
2019-09-16T15:02:51.410Z
2019-09-16T15:02:51.410Z
Matt Wilcox
<p>You might want to look into creating a simple Craft plugin to do this. You can make the first call to add the contact and get the ID in response. Then use that ID to add to a campaign.</p>

<p>Do not be intimidated by plugin development, your problem is fairly easy to solve. If you are on Mac, I like the Paw app to test API calls.</p>

CC BY-SA 4.0
2019-09-11T15:06:11.233Z
I'm doing some plugin development, but ... the biggest issue is knowing what to look for. I'm familiar with watching for a User creation event for example, but I have no clue how to send a POST in JSON format then listen to the response - parse it - and send another POST to the endpoint as a result. The concept is simple... the mechanics mostly a mystery.
Matt Wilcox
CC BY-SA 4.0
2019-09-11T15:49:43.043Z
You might be interested in my Craft Recaptcha plugin which makes a POST request from the backend using Guzzle https://github.com/clarknelson/craft-recaptcha-3/blob/master/src/controllers/DefaultController.php#L62
Clark Nelson
CC BY-SA 4.0
2019-09-11T14:45:49.387Z
2019-09-11T14:45:49.387Z
Clark Nelson
<p>Craft Webhooks is great for sending one POST to a service... but if you need to parse the response from that hook... is there a way to do that? I can't see it as any option in the plugin, and I can't see a Service or anything for having Craft listen to that event?</p>

<p>I'm trying to get it so when a new User is created it's also subscribed to an Active Campaign account. I've no problem creating the Contact in Active Campaign through the Webhook plugin - it works flawlessly. But you can't then add the new Contact to an Active Campaign List because that requires a second POST that includes the new ContactID and a pre-defined List ID.</p>

<p>Craft has no clue about the new ContactID because it wasn't listening or parsing the response to the first successful Webhook (which contains an object with that data in it).</p>

<p>Likewise, it doesn't look as though it's possible to perform both actions in one API call.</p>

<plugin-development><plugin-webhooks>
Doing something with the success response from a Webhook
# Doing something with the success response from a Webhook

(Asked by: username_0 on 2019-09-11)

Craft Webhooks is great for sending one POST to a service... but if you need to parse the response from that hook... is there a way to do that? I can't see it as any option in the plugin, and I can't see a Service or anything for having Craft listen to that event?

I'm trying to get it so when a new User is created it's also subscribed to an Active Campaign account. I've no problem creating the Contact in Active Campaign through the Webhook plugin - it works flawlessly. But you can't then add the new Contact to an Active Campaign List because that requires a second POST that includes the new ContactID and a pre-defined List ID.

Craft has no clue about the new ContactID because it wasn't listening or parsing the response to the first successful Webhook (which contains an object with that data in it).

Likewise, it doesn't look as though it's possible to perform both actions in one API call.

**Tags:** plugin-development, plugin-webhooks


---

## 2 answers

### Answer by username_0 on 2019-09-16. Score: 1 | Accepted answer

Turns out this was not a good use case for the Webhooks plugin - which is better suited to blind "shout outs" to other services than "communication" with them.

I created a plugin instead that uses Guzzle to make API calls, and can do some round-trip requests as a result.


---

### Answer by username_1 on 2019-09-11. Score: 2

You might want to look into creating a simple Craft plugin to do this. You can make the first call to add the contact and get the ID in response. Then use that ID to add to a campaign.

Do not be intimidated by plugin development, your problem is fairly easy to solve. If you are on Mac, I like the Paw app to test API calls.

> **Comments:**
> **username_0**: I'm doing some plugin development, but ... the biggest issue is knowing what to look for. I'm familiar with watching for a User creation event for example, but I have no clue how to send a POST in JSON format then listen to the response - parse it - and send another POST to the endpoint as a result. The concept is simple... the mechanics mostly a mystery.  
> **username_1**: You might be interested in my Craft Recaptcha plugin which makes a POST request from the backend using Guzzle https://github.com/clarknelson/craft-recaptcha-3/blob/master/src/controllers/DefaultController.php#L62  

---

