IBM Cloud Docs
IBM Cloud Functions

IBM Cloud Functions

A Cloud Functions represents a service destination, where an incoming notification can be consumed programmatically to actions.

Generate IBM Cloud Functions endpoint

To post a Cloud Functions notification, you need to generate an endpoint. To generate the endpoint, follow these steps:

  1. Create a IBM Cloud Functions instance. If you already have an Cloud Functions instance, go to step 3.

  2. Create a Namespace. For more information, see here.

  3. Create an Action. For more information, see here.

  4. Select Endpoints from the menu.

    Make sure to uncheck Enable as Web Action and Raw HTTP handling options in the Web Action section for an effective usage of Cloud Functions as a destination.

  5. Copy the URL mentioned and use it in Destination Configuration in Event Notifications instance.

Generate API key for your namespace

  1. From your IBM Cloud dashboard, go to Manage > Access (IAM).

  2. Select Service IDs.

  3. Select your namespace.

  4. Select API keys.

  5. Unlock if the API key is locked by going to Actions > Unlock.

  6. Click Create and provide a Name. This gives you the apikey for the namespace you selected.

  7. Copy api_key and use it in Destination Configuration in Event Notifications instance.

IBM Cloud Functions Cloud Foundary based namespace is not supported. Only IAM-based namespace is supported.

Configuring a Cloud Functions destination

You can configure a Cloud Functions destination in the Destinations tab.

To configure a Cloud Functions destination, do the following steps:

  1. From your Event Notifications instance dashboard, click Destinations.

  2. Click Add + to add new destination.

  3. In the Add a destination side panel, provide the following details.

    • Name - Enter a name for your destination.
    • Description - Optionally, enter a description for your destination.
    • Type - Under Destination, for the Type, select IBM Cloud Functions from the drop-down as your destination type.
    • URL - Enter the Cloud Functions incoming webhook URL. This is the URL that you have generated earlier.
    • API key - Enter the API key that you have generated earlier.
  4. Click Add.

Testing a Cloud Functions destination configuration

You can test a Cloud Functions destination in the options menu provided againts the destination. You can effortlessly test a destination, whether the provided configuration is correct or not with a single click.

For more information on testing a destination, see here.

Cloud Functions retry policy

When calling a webhook, issues such as network errors and application glitches can cause the requests to fail. A retry is used to provide resiliency to external requests. Attempt to retry the requests in such situations by using the following values:

  • Limit = 60 seconds: total time that the service retries.
  • Step = 5 seconds: after each failure, the service waits 5 seconds before retrying. This delay prevents bombarding of the external services (webhook).

In addition, the following timeout conditions cause the Cloud Functions call to fail:

  • A connection timeout of 10 seconds
  • A response timeout of 60 seconds

If a call to the Cloud Functions webhook URL fails even after retry attempts, the notification is lost.