Docs Menu

HTTP Service [Deprecated]icons/link.png

On this page

  • Overview
  • Configuration Parameters
  • Service Actions
  • Incoming Webhooks
  • Configuration
  • Request Payload
  • Example Webhook Function
Third Party Services Deprecation

Third party services in MongoDB Realm have been deprecated in favor of creating HTTP endpoints that use external dependencies.

You can no longer create new third-party services, but existing services will continue to work until December 2022.

Because third party services are now deprecated, they have been removed by default from the Realm UI. If you need to manage an existing third party service, you can add third party services back to the UI by doing the following:

  • In the left navigation, under the Manage section, click App Settings.
  • Enable the toggle switch next to Temporarily Re-Enable 3rd Party Services, and then save your changes.

The MongoDB Realm HTTP Service is a generic interface that enables you to communicate with any service that is available over HTTP, such as those that provide a REST API. This is useful when you need to use a service that does not have a custom service built-in to MongoDB Realm.

You will need to provide values for the following parameters when you create an HTTP service interface:

Service Name
The name of this HTTP service interface. This must be unique from all other service interfaces in your application.

The HTTP service in Realm provides the following actions that you can call in functions and in the SDKs. Each action maps to a standard HTTP request method.

For instructions on using an HTTP service action, see Call a Service Action.


You must enable a service action in a service rule before you can call it.

Configuration Value
Webhook Name

Required. The name of the webhook.


Each incoming webhook in an HTTP service interface must have a unique name.

Respond With Result
Required. If true, MongoDB Realm sends a response to the client that called the webhook. The response body will be the return value of the webhook function.
Run Webhook As

Optional. The id of the Realm user that executes the webhook function when the webhook is called.

HTTP Method

The HTTP method that incoming webhook requests should use. You can configure a webhook to accept any method or specify a specific method. The following methods are supported:

  • GET
  • POST
  • PUT
  • HEAD
  • ANY
Request Validation

The request validation method incoming requests should use. The following validation types are supported:

If Request Validation is enabled, this is the validation secret.

Realm automatically passes a payload document as the first argument to incoming webhook functions. In an HTTP Service incoming webhook the payload object represents an incoming HTTP request and has the following form:

"query": <query parameters>,
"headers": <request headers>,
"body": <request body (BSON)>

A document where each field corresponds to a query parameter that the external service included in the webhook URL.


A request sent to a webhook URL with the query parameters someParameter=42&anotherParameter=hello would have the following query document:

"query": {
"someParameter": 42,
"anotherParameter": "hello"

A document where each field corresponds to an HTTP header that the external service included in the webhook URL.


A request sent to a webhook URL with a Content-Type: application/json header would have the following headers document:

"headers": {
"Content-Type": ["application/json"]

A BSON.Binary object encoded from the request body. You can access the request body by serializing the binary object to a string and then parsing the string to EJSON:

const body = EJSON.parse(payload.body.text())

The following webhook function inserts incoming data into a MongoDB collection and returns the insertedId in the response body.

exports = function(payload, response) {
const mongodb ="mongodb-atlas");
const requestLogs = mongodb.db("test").collection("requestlogs");
body: EJSON.parse(payload.body.text()),
query: payload.query
}).then(result => {
Give Feedback
MongoDB logo
© 2021 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.