Convoy Ingester is a serverless function that acts as a middleware between API providers and Convoy. This enables consumers benefit from Convoy without providers taking advantage of Convoy yet.
The plan is to make this first class support in Convoy, this repo is a prototype for that future.
This function receives webhook events from the provider E.g. Paystack. acks the event and publishes the event to a pub/sub topic. To configure this function
set the environment variable - WEBHOOK_ENDPOINT_ENV_VARS
in GitHub actions with:
WEBHOOK_TOPIC=<insert-topic>,GOOGLE_CLOUD_PROJECT=<insert-project-id>,PAYSTACK_SECRET=<insert-paystack-secret>
This function is triggered from the pub/sub topic earlier and pushes to Convoy. To configure this function set environment variable - PUSH_TO_CONVOY_ENV_VARS
in GitHub actions with:
WEBHOOK_TOPIC=<insert-topic>,GOOGLE_CLOUD_PROJECT=<insert-project-id>,CONVOY_GROUP_ID=<insert-group-id>,CONVOY_API_KEY=<insert-api-key>,CONVOY_PAYSTACK_APP_ID=<insert-app-id>
To run this function, you need to fork the repository. Follow this article to deploy these functions to Google Cloud Functions
- Create a topic on the GCP console. Retrieve the topic's full name. E.g.
projects/{project-name}/topics/{topic-name}
- Add the topic to the Github actions secret with key -
TRIGGER_RESOURCE
curl --request POST \
--url "http://localhost:8080" \
--header "Content-Type: application/json" \
--header "X-Paystack-Signature: <signature>" \
--header "X-Forwarded-For: <insert-ip-address> \
--data '{"event": "charge.created"}'
You can generate dummy hash here