Older versionVersion 2.8HTTP API ConfigurationHow to setup the HTTP API for send SMS

How to setup the HTTP API for send SMS

Prerequisites

- PAS 2.7 installed

- PhenixID Message Gateway configured

Authentication

It is recommended to add authentication to the API. These authentication methods are supported:

- Client certificate (recommended).
Use a reverse proxy to add client certificate authentication. Add valves to the pipe(s) to verify the certificate.

- Basic authentication
Add valves to the pipes to perform basic authentication verification.

Add local http-api module

- Login to configuration manager

- Click the Advanced tab

- Open Modules (click on the pen)

- Add this module (if module is already added, only add tenant and/or allowedOperation):

{
		"module": "com.phenixidentity~phenix-api-authenticate",
		"enabled": "true",
		"config": {
			"tenant": [
				{
					"id": "t1",
					"displayName": "Tenant1",
					"allowedOperation": [
						"sendSMS"
					]
}
			]
		},
		"id": "authapi_module"
	}

- Click Stage Changes and Commit Changes

- Open NODE_GROUPS (click on the pen)

- Add id of the newly added module to module_refs. Example below. (You can skip this step if the module was already added)

{
		"name": "WIN-DHB3ICNDG4E",
		"description": "Default node (created automatically)",
		"config": {
			"module_refs": "authapi_module,sealapp,signapp_1,......"
		},
		"created": "2017-07-03T11:38:03.135Z",
		"id": "493afd0e-0fe8-40e4-b1a1-a24a5e2df6e2",
		"modified": "2017-07-03T14:39:43.257Z"
	}

- Click Stage Changes and Commit Changes

 

Fetch message gateway id reference

- Click the Advanced tab

- Open Globals

- Fetch the id of the message gateway setting

Add pipes to send SMS

In this example, no client certificate is used. Please read the Valves documentation on how to configure a client certificate to the pipe.

- Click the Advanced tab

- Open Pipes (click on the pen)

- Add this pipe.

{
		"id": "sendSMS",
		"description": "Send SMS",
		"valves": [
			{
				"name": "ItemCreateValve",
				"enabled": "true",
				"config": {
					"dest_id": "{{request.mobile}}"
				}
			},
			{
				"name": "SMSValve",
				"config": {
					"recipient_param_name": "{{request.mobile}}",
					"userid_param_name": "{{request.mobile}}",
					"wash_recipient_number": "true",
					"use_flash": "false",
					"message_gateway_settings": "f7582459-f3c1-4fda-b872-45e1e9450888",
					"message": "{{request.message}}"
				}
			}
		]
	}

- Change the message_gateway_settings value to the previously fetched id value.

- Click Stage Changes and Commit Changes

Test

Use a HTTP rest client for testing and debugging. Follow the document Using HTTP API to send SMS to structure the HTTP requests properly.