https://github.com/grokify/ringcentral-permahooks
Webhook proxy to turn RingCentral webhooks into permanent webhooks for use with services like Zapier Instant Triggers.
https://github.com/grokify/ringcentral-permahooks
ringcentral webhooks
Last synced: 7 months ago
JSON representation
Webhook proxy to turn RingCentral webhooks into permanent webhooks for use with services like Zapier Instant Triggers.
- Host: GitHub
- URL: https://github.com/grokify/ringcentral-permahooks
- Owner: grokify
- License: mit
- Created: 2018-01-10T04:42:06.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-05-05T10:09:30.000Z (8 months ago)
- Last Synced: 2025-05-05T11:22:02.432Z (8 months ago)
- Topics: ringcentral, webhooks
- Language: Go
- Homepage:
- Size: 1.43 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RingCentral Permahooks
[![Build Status][build-status-svg]][build-status-url]
[![Lint Status][lint-status-svg]][lint-status-url]
[![Go Report Card][goreport-svg]][goreport-url]
[![Docs][docs-godoc-svg]][docs-godoc-url]
[![License][license-svg]][license-url]
[![Docker Pulls][docker-hub-svg]][docker-hub-url]
This is a small app that turns RingCentral's expiring outbound webhooks into non-expiring webhooks. This is especially useful when connecting to a service with a simple inbound webhook implementation such as Zapier and chat solutions like [Glip](https://glip.com). Benefits include:
* Seamlessly links RingCentral Outbound Webhooks with Inbound Webhooks offered by Zapier, Glip and others.
This is useful because RingCentral's webhook implementation has a couple of features that are not supported by all webhook consuming services. Both of the below are handled automatically by this service.
* RingCentral requires the webhook endpoint return the request `Validation-Token` header in the response to indicate the receiving endpoint is the correct one.
* RingCentral webhooks expire to ensure the correct site is receiving the information.
Deployment options:
* Run locally: only the `main.go` file is necessary as shown below.
* Lambda: TBD, will use [aws/aws-lambda-go](https://github.com/aws/aws-lambda-go) like [Chathooks](https://github.com/grokify/chathooks)
See more information about creating RingCentral webhooks here:
* API Reference: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefCreateSubscription
* Developer Guide: http://ringcentral-api-docs.readthedocs.io/en/latest/webhooks/
## Pre-requisites
You must have created an app on the RingCentral Developer Platform by logging into the Developer Portal:
https://developer.ringcentral.com
The app must have the following settings:
* Application Type: `Private`
* Platform Type: `Server-only (No UI)`
* OAuth Grant Types: `Refresh Access Token`, `Password flow`
* Permissions: `Read Messages`, `Webhook Subscriptions`
In the Developer Portal, your app will look like this.

## Installation and Configuration
Before you can complete the following installation procedure, you need to get a webhook URL from your downstream service. For example, a Zapier webhook URL.
```bash
$ go get github.com/grokify/ringcentral-permahooks
$ cd $GOPATH/src/github.com/grokify/ringcentral-permahooks
$ cp sample.env .env
$ vi .env
$ go run main.go
```
After you start the service, create a webhook by calling the `/createhook` endpoint. You can also call the `/renewhook` endpoint to manually renew the webhook. For example:
```bash
# Create Webhook
$ curl -XGET 'https://12345678.ngrok.io/createhook'
# Renew Webhook
$ curl -XGET 'https://12345678.ngrok.io/renewhook'
```
Successfully calling `/createhook` will result in log entries like the following:
```bash
$ go run main.go
INFO[0023] Creating Hook...
INFO[0024] {"eventFilters":["/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS","/restapi/v1.0/subscription/~?threshold=86400\u0026interval=3600"],"deliveryMode":{"transportType":"WebHook","address":"https://12345678.ngrok.io/webhook"},"expiresIn":604800}
INFO[0025] Handling webhook...
INFO[0025] Validation-Token: 11112222-3333-4444-5555-666677778888
INFO[0025] Created/renewed Webhook with Id: 11112222-3333-4444-5555-666677778888
```
### Tunneling
If your server is behind a NAT or a firewall and not accessible via the Internet, you can use a tunneling service such as [ngrok](https://ngrok.com/). In the following example, you would create a RingCentral webhook to `https://12345678.ngrok.io/webhook` which you would set as `PERMAHOOKS_INBOUND_WEBHOOK_URL` in your environment.
```bash
$ ngrok http 8080
ngrok by @inconshreveable (Ctrl+C to quit)
Tunnel Status online
Update update available (version 2.2.8, Ctrl-U to update)
Version 2.0.25/prod
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://12345678.ngrok.io -> localhost:8080
Forwarding https://12345678.ngrok.io -> localhost:8080
Connections ttl opn rt1 rt5 p50 p90
83 0 0.00 0.00 18.68 301.08
```
## To Do
### Docker Hub
Docker repo: https://hub.docker.com/r/grokify/ringcentral-permahooks
1. Build: `% docker build -t grokify/ringcentral-permahooks:v0.2.3 .`
1. Login: `% docker login -u [username] -p [password]`
1. Push: `% docker push grokify/ringcentral-permahooks:v0.2.3`
### Heroku Support
Heroku support is under investigation. For Heroku, dependences are managed with `godep`. The following is used:
```bash
$ go get -u github.com/tools/godep
$ cd $GOPATH/src/github.com/grokify/ringcentral-permahooks
$ godep save ./...
```
More information is avialable here:
https://devcenter.heroku.com/articles/go-dependencies-via-godep
## Support
If you have questions or support, please use the following resources:
* Stack Overflow: https://stackoverflow.com/questions/tagged/ringcentral
* GitHub: https://github.com/grokify/ringcentral-permahooks/issues
[build-status-svg]: https://github.com/grokify/ringcentral-permahooks/actions/workflows/ci.yaml/badge.svg?branch=master
[build-status-url]: https://github.com/grokify/ringcentral-permahooks/actions/workflows/ci.yaml
[lint-status-svg]: https://github.com/grokify/ringcentral-permahooks/actions/workflows/lint.yaml/badge.svg?branch=master
[lint-status-url]: https://github.com/grokify/ringcentral-permahooks/actions/workflows/lint.yaml
[goreport-svg]: https://goreportcard.com/badge/github.com/grokify/ringcentral-permahooks
[goreport-url]: https://goreportcard.com/report/github.com/grokify/ringcentral-permahooks
[docs-godoc-svg]: https://pkg.go.dev/badge/github.com/grokify/ringcentral-permahooks
[docs-godoc-url]: https://pkg.go.dev/github.com/grokify/ringcentral-permahooks
[license-svg]: https://img.shields.io/badge/license-MIT-blue.svg
[license-url]: https://github.com/grokify/ringcentral-permahooks/blob/master/LICENSE.md
[docker-hub-svg]: https://img.shields.io/docker/pulls/grokify/ringcentral-permahooks?logo=docker&label=docker%20pulls%20%2F%20ringcentral-permahooks
[docker-hub-url]: https://hub.docker.com/r/grokify/ringcentral-permahooks