https://github.com/surinderbhomra/nexudus-netlify-functions
Using Netlify functions to integrate with the Nexudus API. A possible work in progress where further Nexudus API endpoints can be added.
https://github.com/surinderbhomra/nexudus-netlify-functions
netlify netlify-functions nexudus
Last synced: about 2 months ago
JSON representation
Using Netlify functions to integrate with the Nexudus API. A possible work in progress where further Nexudus API endpoints can be added.
- Host: GitHub
- URL: https://github.com/surinderbhomra/nexudus-netlify-functions
- Owner: SurinderBhomra
- Created: 2024-10-23T17:26:59.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-10-23T22:32:52.000Z (7 months ago)
- Last Synced: 2025-02-07T15:45:02.295Z (3 months ago)
- Topics: netlify, netlify-functions, nexudus
- Language: JavaScript
- Homepage: https://www.surinderbhomra.com/Blog/Tag/nexudus
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nexudus API - Netlify Functions #
## Setup ##
### Netlify CLI ###
If running this project for the first time, the Netlify CLI will need to be installed first. This is will only need to be done once.
```
npm install -g netlify-cli
```To test the serverless functions locally, the `netlify dev` command needs to be run in your project's main folder. This starts a local server.
All functions can be found at `http://localhost:8888/api/{function-name}`.
### NPM Dependencies ###
```
npm install node-fetch
```## Nexudus API Authentication ##
All connections to the Nexudus CRM API will be carried out through the platforms [Basic Authentication](https://developers.nexudus.com/reference/basic-authentication) process, which requires the User Name and Password.
These values will be stored in Environment Variables:
```
NEXUDUS_USERNAME="username"
NEXUDUS_PASSWORD="password"
```When running the serverless functions locally, a `.env` file will need to be added to the root of the project containing the above contents.
## Serverless Functions Use ##
### Add Newsletter Subscriber ###
**Request URL Endpoint:** `/api/add-newsletter-subscriber`
**Method:** POST**Example Request Body:**
```
{
"business_id": 1234567890,
"group_ids": [
1234567890
],
"name": "Full Name",
"email_address": "[email protected]",
"company_name": "SSB Ltd",
"visit_reason": "N/A"
}
```**Success Response:** 200. The ID of the record created will be provided.
```
200:{
"id": 12345678
}
```**Unsuccessful Response:** 400 for invalid request, or 500 if a record could not be created in Nexudus.
```
400:{
"error_message": "Invalid request. No JSON was provided."
}400 - Missing Business ID:
{
"error_message": "Business ID is required.",
"error_field": "business_id"
}400 - Missing Group IDs:
{
"error_message": "An array of To Group IDs is required.",
"error_field": "group_ids"
}400 - Missing Name:
{
"error_message": "Name is required.",
"error_field": "name"
}400 - Missing Email Address:
{
"error_message": "Email Address is required.",
"error_field": "email_address"
}500:
{
"error_message": "Unable to send request."
}
```