Create a New Function and NAF App

Prev Next

From Narmi Command, you can create a Narmi Function using one of our pre-built templates or start from a custom code zip archive. If you are using a custom code archive, refer to the Technical Limitations to ensure your project meets the requirements.

VPN Connection

If you are planning to connect to your banking core from the function and your institution uses a VPN to connect to the core, you must enable core connectivity with additional settings. Go to VPN Connectivity for instructions.

We recommend starting with one of the Hello World templates in order to get familiar with how Narmi Functions works. For these instructions, we’ll use the Hello World Hosted NAF template and create a simple NAF App to display text within Online Banking. This process involves creating a new function, registering a NAF app, updating the template code, and testing your app.

Note: Please see these staff permissions required to create and manage Narmi Functions.

Create a New Function

To create a new function from a template:

1. From Narmi Command, select Extensions > Narmi Functions, then select Add function.
NF1market

2. On the page that appears, select Start from a template.
NF2

3. Enter the Function name and Description. The function name is the title that will display in the Narmi Functions list and the description will display in the function details page. Enter a simple description that users will understand at a glance.
NF3

4. Below the Description are several templates to choose from. For full details on each available template, go to Built-in Templates.

For this example, select the Hello World hosted NAF template.

If you would like to look through the function code to understand it more before deploying, select Download code.

imagedev

5. Select the function type, which will determine how the function can be invoked and is dependent on the use case the function is meant to fulfill.
NF5


There are three supported function types:

  • Webhook– A webhook for a specific user event, or “trigger event,” is created, and the function will be invoked via that webhook each time the trigger event occurs. Depending on the type of event, the request body will include resource_id, user_id, or additional_id.
  • Schedule – The function is executed on a regular schedule and requires a CRON expression to describe individual details of the schedule. Go to CRON expressions for an explanation of CRON fields and characters.
  • Narmi Application Framework– This function is invoked via its URL, either by a user visiting it through the NAF App (which adds it to the Online Banking product), or via an API request. The request here contains a token, which can be decrypted using the NAF App’s Client Secret to validate the legitimacy of each request. Select the request method your NAF Application will be using.

For this example, select the Narmi Application Framework type and GET as the request method for the NAF App.

6. If needed for your function, select the environment variables. These can be added as key-value pairs and will be added to your function’s runtime environment. All environment variables are encrypted at rest. Checking the encrypted option for an environment variable also guarantees it will be encrypted in transit using an AWS KMS encryption key (all environment variables use TLS in transit regardless), but also will require an additional API call to be made in your function to decrypt the variable. This option must be selected for any secrets. Additional information for variable decryption is available with the decrypt template.

No environment variables are required for this example using the Hello World hosted NAF function.

7. Select Upload to create your function. The function State displays “Creating.”
NF6

It takes approximately 30 seconds for the function to be created and all resources to be provisioned. Refresh the page to see the latest status.

Once the function is created, the State updates to “Active.”
NF7

8. Once the function is active, copy the Frontend URL, which will be used for the Redirect URL when you register a NAF App in step 2 of the next section.
NF8

Optionally, at the top of this page, select the Code tab to view or manually edit the backend code, or select the Monitor tab to view backend function metrics or download logs. Go to Maintain and Monitor Functions to learn more about the actions on this page.

You can also test your Narmi Function by sending a test event. From the Actions sidebar, select Submit a test event.
NF9

9. In the panel that opens, select Submit test event. The Result box displays the resulting output.
NF10

Register a NAF App

1. For some integrations, like this example, you’ll need to register a NAF App. Stay in Narmi Command and select Extensions > NAF Apps, then select Register new app.

Image

2. On the page that appears, enter the function's Frontend URL you copied into the Redirect URL field. For user-facing apps like this example, select Yes for Should the app be public and visible to users? Additionally, select New tab (GET) so the application opens in a new tab in Online Banking.
NF12

3. Select Register app. The Client Secret will appear onscreen once you complete registration of the NAF App. Some integrations require the Client Secret, so copy that secret to enter in the function’s environment variables, if needed.
NF13

For complete instructions on NAF Apps, go to Register a New NAF App.

Your registered NAF App displays in the NAF Apps list, where you can copy the Client ID, if needed for your integration. To create an access token, select Manage Tokens > Add new token.
NF14

Update Template Code with Backend URL

Next, you’ll need to update your template code with the Narmi Function Backend URL so that the frontend static website sends requests to the correct backend.

1. Go back to Narmi Command and under Narmi Functions, select your function.

2. Copy the Backend URL (you will paste this in step 5).
NF15

3. Under Actions, select Download Code > Download frontend code.
NF16

4. Unzip the downloaded function code and open the index.js file.

5. Paste the Backend URL into the function code and save.
NF17

6. Zip the updated files so you can upload them in the next step. Note: In order for the zip file to upload properly, you must use the zip command line command found on all major operating systems.

7. Back in your function, under Actions, select Update function configuration.
NF18

8. Under Select a zip file to be deployed as a static website, choose Select File.
NF21

9. Select Upload. After about 30 seconds, refresh. Once you see the “Active” state, your function is ready to test.
NF19

Test Your App

To test your app, log in to online banking as a user.
Select Tools on the top navigation bar, and then select your NAF App name.
NF20