Docs Menu

Call a Service Action [Deprecated]

On this page

  • Overview
  • Call from a Function
Important
Third Party Services & Push Notifications Deprecation

Third party services and push notifications in Atlas App Services have been deprecated in favor of creating HTTP endpoints that use external dependencies in functions.

Webhooks have been renamed to HTTPS Endpoints with no change in behavior. You should migrate existing Webhooks.

Existing services will continue to work until December 2022.

Because third party services and push notifications are now deprecated, they have been removed by default from the Atlas App Services UI. If you need to manage an existing third party service or push notification, you can add the configurations 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.

You can call actions associated with a service from App Services Functions, including incoming webhooks and triggers, or directly from a connected client application. Each service action is available as a method on its respective service client.

Note

You must configure a service rule that enables an action before you can call it.

The examples in this section demonstrate calling the post() action from the HTTP Service. Each service action follows a similar pattern but has distinct parameters. For details on the parameters and usage of a specific action, refer to that action's reference page.

To call a service action from a function:

  1. Instantiate a service client from function context using the context.services interface.
  2. Call the method associated with the action.
const http = context.services.get("myHttpService");
http.post({
"url": "https://www.example.com",
"headers": { "Content-Type": ["application/json"] },
"body": { "msg": "Hello from a service action!" }
})
.then(() => "Successfully sent the post request!")
←  Convert Webhooks to HTTPS EndpointsWebhook Requests & Responses [Deprecated] →
Give Feedback
© 2022 MongoDB, Inc.

About

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