logo
  • Core Gateway
  • Pricing
  • Install Convoy
  • Install Convoy
Blog
Product Update

Publish an event to multiple endpoints using convoy

2 min read March 09, 2022

Written by

Daniel Oluojomu
Daniel Oluojomu

Backend Engineer

Share

One common scenario in publishing webhook events is enabling users to provide multiple endpoints to receive events. One easy example is publishing an event that the user needs to process at more than one location. This location could be a no-code platform like zapier, a newly minted microservice or serverless function, or a good old slack notification. In this article, I’d like to explain how you can achieve this using Convoy.

multiple endpoints

Without Convoy, your users have to build in the fan-out mechanism themselves, which is more stressful.

Prerequisites

To follow along you would need the following

  1. A Convoy Cloud account.
  2. An Outgoing Project ID & API Key.

Steps

Create Two Endpoints

First, we have to create two endpoints with the same owner_id , you can think of owner_idas an id used to group multiple endpoints under one entity e.g merchant.

For the first endpoint:

Sample Payload
{
  "description": "test-endpoint-1",
  "owner_id": "<your-owner-id>",
  "events": [ "*" ],
  "secret": "12345",
  "url": "https://<your-endpoint-url>"
}
Bash
$ curl \
    --request POST \
    --data @endpoint-1.json \
    -H "Content-Type: application/json" \
    https://dashboard.getconvoy.io/api/v1/projects/{projectID}/endpoints
{
	"status": true,
	"message": "Endpoint created successfully",
	"data": {
		"uid": "7556a922-7d10-47b1-b254-4dde679d9fbd",
		"project_id": "acc1bf6d-c309-4a99-b9a7-a9410fa5f6c4",
		"target_url": "https://<your-endpoint-url>",
		"owner_id": "<your-owner-id>",
		"title": "test_endpoint_1",
		"secrets": [
			{
				"uid": "72e9d70f-b57e-4f49-b098-01e8ea9795e7",
				"value": "1234",
				"created_at": "2022-12-15T13:38:01.638Z",
				"updated_at": "2022-12-15T13:38:01.638Z"
			}
		],
		"advanced_signatures": false,
		"description": "xx",
		"http_timeout": "",
		"rate_limit": 5000,
		"rate_limit_duration": "1m0s",
		"authentication": null,
		"created_at": "2022-12-15T13:38:01.638Z",
		"updated_at": "2022-12-15T13:38:01.638Z"
	}
}

For the second endpoint:

Sample Payload
{
  "description": "test-endpoint-2",
  "owner_id": "<your-owner-id>",
  "events": [ "*" ],
  "secret": "12345",
  "url": "https://<your-endpoint-url>"
}
Bash
$ curl \
    --request POST \
    --data @endpoint-2.json \
    -H "Content-Type: application/json" \
    https://dashboard.getconvoy.io/api/v1/projects/{projectID}/endpoints
{
	"status": true,
	"message": "Endpoint created successfully",
	"data": {
		"uid": "7556a922-7d10-47b1-b254-4dde679d9fbd",
		"project_id": "acc1bf6d-c309-4a99-b9a7-a9410fa5f6c4",
		"owner_id": "<your-owner-id>",
		"target_url": "https://<your-endpoint-url>",
		"title": "test_endpoint_2",
		"secrets": [
			{
				"uid": "89e9d70f-b57e-4f49-b098-01e8ea9795e7",
				"value": "1234",
				"created_at": "2022-12-15T13:38:01.638Z",
				"updated_at": "2022-12-15T13:38:01.638Z"
			}
		],
		"advanced_signatures": false,
		"description": "xx",
		"http_timeout": "",
		"rate_limit": 5000,
		"rate_limit_duration": "1m0s",
		"authentication": null,
		"created_at": "2022-12-15T13:38:01.638Z",
		"updated_at": "2022-12-15T13:38:01.638Z"
	}
}

Create One Subscription for Each Endpoint

Now we have to create subscriptions for each endpoint.

Sample Payload
{
  "endpoint_id": "<your-endpoint-id>",
  "name": "test-sub-1"
}
Bash
$ curl \
    --request POST \
    --data @subscription-1.json \
    -H "Content-Type: application/json" \
    https://dashboard.getconvoy.io/api/v1/projects/{projectID}/subscriptions
{
	"status": true,
	"message": "Subscription created successfully",
	"data": {
  	  "uid": "eb1e6167-d076-4366-b458-2ca7e358986e",
	  "endpoint_id": "<your-endpoint-id>",
		"name": "test-sub-1",
		"type": "api",
		"status": "active",
		"filter_config": {
			"event_types": [
				"*"
			],
			"filter": {}
		},
		"created_at": "2022-12-15T13:56:22.256Z",
		"updated_at": "2022-12-15T13:56:22.256Z"
	}
}

Repeat the same for the second subscription.

Publish Event

Now let us publish an event with the type to our endpoints. We’ll specify the owner_id we used for both endpoints, this allows convoy to dispatch the event to both endpoints.

Sample Payload
{
  "owner_id": "<your-owner-id>",
  "data": {
		"blog": "https://getconvoy.io/blog"
	},
  "event_type": "ping"
}
Bash
$ curl \
    --request POST \
    --data @event.json \
    -H "Content-Type: application/json" \
    https://dashboard.getconvoy.io/api/v1/projects/{projectID}/events
{
	"status": true,
	"message": "Endpoint event created successfully",
	"data": {
		"uid": "cdff6a37-8a41-412b-aa55-748cdefd8017",
		"event_type": "ping",
		"project_id": "acc1bf6d-c309-4a99-b9a7-a9410fa5f6c4",
		"endpoints": [
			"b5e4d42e-3ad6-4546-9f88-4f36b3f82941",
			"7556a922-7d10-47b1-b254-4dde679d9fbd"
		],
		"data": {
			"blog": "https://getconvoy.io/blog"
		},
		"created_at": "2022-12-15T13:39:45.276Z",
		"updated_at": "2022-12-15T13:39:45.276Z"
	}
}

Show Endpoint Response

The screenshots below show that the events were routed to the two endpoints.

Endpoint-1 Webhook Endpoint-2 Webhook

Conclusion

In this post, we discussed why letting your users provide multiple endpoints is important. We demostrated this ability in Convoy and how to use it. Sounds good for your platform? Why not try out our free cloud and give us feedback on our slack community!

Till next time ✌🏽

← Previous articleWe raised $437k in pre-seed funding to build ConvoyNext article →Convoy v0.6

Related Posts

Convoy now ships with a simpler architecture.

September 11, 2024

In our latest release, we’ve simplified Convoy’s architecture. In this article I describe a little bit more about the architecture and the benefits for Convoy.

Subomi Oluwalana
Subomi Oluwalana

Co-Founder & CEO

Convoy v24.4.1 Release Notes

April 30, 2024

Convoy v24.4.1 release has landed 🎉. We’ve been working on these improvements and we are super excited to share this release. These include a rate limiter backed by PostgreSQL, RabbitMQ message broker support, payload mutation using JavaScript functions for message broker sources, and lots of bug fixes.

Raymond Tukpe
Raymond Tukpe

CTO

Announcing Convoy’s Managed Service

November 06, 2023

Presenting Convoy's all-new cloud platform. Tailored to simplify webhooks management like never before, join us as we unveil our exciting new cloud offering featuring dedicated instances, expanded regional availability, competitive pricing, industry standard security, and uncompromising compliance.

Raymond Tukpe
Raymond Tukpe

CTO

Access Control & Advanced Portal Links

June 30, 2023

Welcome to day 5 of Convoy Launch week! We are thrilled to unveil two exciting features, Access Controls & Advanced Portal Links, that will elevate your experience with Convoy. In this article, we will delve into these groundbreaking features and explore the immense value they bring to Convoy's offering. Whether you're a developer seeking flexibility and efficiency or a user craving seamless access to event data, these features are designed to revolutionize the way you and your customers interact with Convoy.

Daniel Oluojomu
Daniel Oluojomu

Backend Engineer

logo

2261 Market Street, San Francisco, CA 94114

Companyaccordion icon

About Us

Trust Center

Terms of Use

Privacy Policy

DPA

Productaccordion icon

Open Source

Core Gateway

Self-Hosted Premium

Private Network

Free Trial

Convoy Playground

Use Casesaccordion icon

Fintech

AI & Machine Learning

Developer Tools

Healthcare

SaaS Platforms

E-commerce

Logistics

IoT & Devices

Resourcesaccordion icon

API Reference

Documentation

Blog

Status Page

Roadmap

What are Webhooks?

Convoy vs. Internal Implementation

Speak to usaccordion icon

Slack

[email protected]

Connect with us

Copyright 2026, All Rights Reserved

soc stamp