This document provides instructions for using the Simpletalk webhook to retrieve active job information for a customer.
POST /webhooks/simpletalk/jobs
This endpoint is protected by an API key. You must include a valid API key in the X-API-KEY header of your request.
- Header:
X-API-KEY - Value: Your secret API key
The request body must be a JSON object containing the customer's phone number.
- Content-Type:
application/json
| Parameter | Type | Description |
|---|---|---|
phoneNumber |
String | The customer's phone number. |
Example:
{
"phoneNumber": "+15551234567"
}The webhook will return a JSON object containing the customer's information and a list of their active jobs.
Success (200 OK):
{
"customer": {
"name": "John Doe",
"phone": "+15551234567"
},
"activeJobs": [
{
"jobId": 123,
"status": "en_route",
"proxyNumber": "+15557654321",
"technician": {
"name": "Mike Smith"
},
"serviceLocation": {
"address": "123 Main St, Anytown, USA"
}
}
]
}Error Responses:
- 400 Bad Request: The
phoneNumberis missing from the request body. - 401 Unauthorized: The API key is missing.
- 403 Forbidden: The API key is invalid.
- 404 Not Found: The customer could not be found.
- 500 Internal Server Error: An unexpected error occurred.
POST /webhooks/simpletalk/notifications
This endpoint is protected by an API key. You must include a valid API key in the X-API-KEY header of your request.
- Header:
X-API-KEY - Value: Your secret API key
The request body must be a JSON object containing the notification details.
- Content-Type:
application/json
| Parameter | Type | Description |
|---|---|---|
title |
String | The title of the notification. |
message |
String | The body text of the notification. |
recipients |
Integer or Array[Integer] | The User ID(s) of the recipient(s). |
from |
String (Optional) | The sender identifier. |
to |
String (Optional) | The recipient identifier (string representation). |
Example:
{
"title": "New Job Assigned",
"message": "You have been assigned a new job.",
"recipients": [123],
"from": "System",
"to": "Technician Mike"
}The webhook will return a JSON object containing the created notification and push notification status.
Success (201 Created):
{
"newNotification": {
"id": 1,
"title": "New Job Assigned",
"message": "You have been assigned a new job.",
"from": "System",
"to": "Technician Mike",
"recipients": [123],
"createdAt": "2023-10-27T10:00:00.000Z",
"updatedAt": "2023-10-27T10:00:00.000Z"
},
"newPushNotification": {
"success": true,
"message": "Push notification sent"
}
}Error Responses:
- 401 Unauthorized: The API key is missing.
- 403 Forbidden: The API key is invalid.
- 500 Internal Server Error: An unexpected error occurred.
POST /webhooks/simpletalk/form-submissions/search
This endpoint is protected by an API key. You must include a valid API key in the X-API-KEY header of your request.
- Header:
X-API-KEY - Value: Your secret API key
The request body should be a JSON object where the keys correspond to the form field names (e.g., phone, full_name, service_type) and the values are the strings to search for. The search performs a case-insensitive partial match on the values.
- Content-Type:
application/json
Example:
{
"phone": "737932",
"full_name": "John"
}This will find submissions where the phone number contains "737932" AND the full name contains "John".
The webhook will return an array of matching form submission objects.
Success (200 OK):
[
{
"id": 155383,
"submission": [
{
"name": "full_name",
"value": "John Doe"
},
{
"name": "phone",
"value": "(737) 932-4565"
},
...
],
"status": "pending",
"createdAt": "2023-10-27T10:00:00.000Z",
"updatedAt": "2023-10-27T10:00:00.000Z"
}
]Error Responses:
- 400 Bad Request: The payload is missing or empty.
- 401 Unauthorized: The API key is missing.
- 403 Forbidden: The API key is invalid.
- 500 Internal Server Error: An unexpected error occurred.