Created
August 27, 2022 10:02
-
-
Save stefanozanella/63389941b3485f6a829492a6447b6797 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
class WebhooksController { | |
@Autowired | |
private lateinit var client: WebClient | |
@PostMapping("/webhooks/hubspot") | |
fun hubspot(@RequestBody events: List<Map<String, String>>) { | |
events | |
.map { event -> | |
client | |
.get() | |
.uri("https://api.hubapi.com/crm/v3/objects/deals/{objectId}") { uri -> | |
uri | |
.queryParam("properties", "hubspot_owner_id,hs_arr,amount,dealstage") | |
.build(event["objectId"]) | |
} | |
.retrieve() | |
.bodyToMono<String>() | |
.block() | |
} | |
.forEach(::println) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment