
A webhook is a mechanism that pushes real-time notifications from a feature service to an endpoint you created that is listening for ArcGIS Survey123 events. ArcGIS Survey123 supports integration with webhooks and pushes updates to a hosted feature layer in your ArcGIS Online or ArcGIS Enterprise portal. You can use webhooks to create custom tasks to perform operations such as notifying and sending messages to applications after a survey is submitted, updated, or deleted.
When Survey123 updates a hosted feature layer, you can use webhooks to perform operations such as:
- Send email notifications when surveys are submitted.
- Send Slack notifications when surveys are updated.
- Send Microsoft Teams notifications when surveys are deleted.
- Connect with enterprise systems to update databases or spreadsheets.
- Build conditional workflows to automate tasks based on survey responses.
Prerequisites
To use webhooks in ArcGIS Survey123:
You need an ArcGIS Online or ArcGIS Enterprise account with:
- Administrator role, Publisher role, or Owner of the hosted feature layer.
- Non-admins with update control rights (from a shared update group) can also create webhooks.
- Access to ArcGIS Survey123.
- Permission to create and manage surveys.
You need a webhook endpoint that:
- Accepts HTTP POST requests.
- Returns HTTP status codes.
- Handles JSON payloads.
- Is publicly accessible.
How to automate workflows with webhooks
To automate workflows with webhooks, you configure HTTP endpoints that receive real-time notifications when survey events occur. These endpoints can process survey data, trigger automated actions, and integrate with external systems to create seamless workflows that eliminate manual data transfer and processing.
The general steps to automate your custom workflows with webhooks are:
-
Create an HTTP endpoint that can receive and process webhook notifications.
- You can use a webhook receiver, a webhook service, or a webhook proxy. Learn more about how to create a sample webhook receiver in the Code Examples section.
-
Configure a webhook in one of three locations:
- Organization > Settings > Webhooks (for administrators)
- My Settings > Webhooks (for non-administrators)
- Item Details Page > Settings > Webhooks (for hosted feature layers)
-
Test and monitor your webhook by submitting a Survey123 survey through the Survey123 Field App or the Survey123 Web App.
- You can use services like Webhook.site or RequestBin to test and monitor your webhook.
Webhook event types
Survey123 webhooks support the following event types:
| Event Type | Description | When Triggered |
|---|---|---|
add | New survey response submitted | When a survey is completed and submitted |
update | Existing survey response modified | When a submitted survey response is edited |
delete | Survey response deleted | When a survey response is removed |
Payload structure
Survey123 sends this JSON structure to your endpoint. The contents of the payload will differ based on your survey configuration and the event type:
{
"eventType": "FeaturesCreated",
"portalInfo": {
"name": "ArcGIS Online",
"url": "https://www.arcgis.com"
},
"surveyInfo": {
"name": "Field Inspection",
"id": "123456",
"formItemId": "form-item-id",
"formTitle": "Form Title",
"serviceItemId": "service-item-id",
"serviceUrl": "service-url"
},
"userInfo": {
"username": "inspector1",
"firstName": "John",
"lastName": "Doe",
"fullName": "John Doe",
"email": "john@example.com"
},
"feature": {
"attributes": {
"inspection_type": "safety",
"status": "failed",
"notes": "Requires immediate attention",
"globalid": "{FB29BDB9-79DD-4A7E-882A-A7B5B1932320}",
"objectid": 57
},
"geometry": {
"x": -122.84153767025904,
"y": 49.18022516016153,
"spatialReference": { "wkid": 4326 }
}
}
}Code Examples
Below are practical examples showing how to implement webhook automation for common Survey123 scenarios:
Sample webhook receiver
When you implement a webhook receiver, you can use a basic Python Flask app to receive and log webhooks. Here is an example of a webhook receiver:
from flask import Flask, request, jsonify
import logging
app = Flask(__name__)
logging.basicConfig(level=logging.INFO)
@app.route('/webhook', methods=['POST'])
def survey123_webhook():
data = request.json
logging.info(f"Received webhook: {data}")
# Add your processing logic here
return jsonify({"status": "success"}), 200
if __name__ == '__main__':
app.run(port=5000)Store survey responses in a database
Example of storing survey responses in a PostgreSQL database:
from flask import Flask, request, jsonify
import psycopg2
import json
from datetime import datetime
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def store_survey():
data = request.json
# Validate required fields
if not data or 'surveyInfo' not in data or 'feature' not in data:
return jsonify({"error": "Invalid payload"}), 400
# Extract survey data
survey_id = data['surveyInfo']['id']
attributes = data['feature']['attributes']
# Connect to database
conn = psycopg2.connect(
dbname="your_database",
user="your_user",
password="your_password",
host="your_host"
)
cur = conn.cursor()
try:
# Insert survey response (serialize attributes as JSON)
cur.execute("""
INSERT INTO survey_responses
(survey_id, response_data, created_at)
VALUES (%s, %s, %s)
""", (survey_id, json.dumps(attributes), datetime.now()))
conn.commit()
return jsonify({"status": "success"}), 200
except Exception as e:
conn.rollback()
return jsonify({"error": str(e)}), 500
finally:
cur.close()
conn.close()Send email notifications
When a survey is submitted, you can send an email notification to a recipient. Here is an example of sending email notifications when surveys are submitted:
from flask import Flask, request, jsonify
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from datetime import datetime
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def notify_submission():
data = request.json
# Validate required fields
if not data or 'surveyInfo' not in data or 'userInfo' not in data:
return jsonify({"error": "Invalid payload"}), 400
# Extract survey info
survey_name = data['surveyInfo']['name']
username = data['userInfo']['username']
# Email server settings
smtp_server = "smtp.your-server.com"
smtp_port = 587
sender_email = "your-email@domain.com"
password = "your-password"
recipient = "recipient@domain.com"
# Create email content
subject = f"New Survey Submission: {survey_name}"
body = f"""
New survey response received:
Survey: {survey_name}
Submitted by: {username}
Time: {datetime.now()}
"""
try:
# Create and send email
message = MIMEMultipart()
message["From"] = sender_email
message["To"] = recipient
message["Subject"] = subject
message.attach(MIMEText(body, "plain"))
with smtplib.SMTP(smtp_server, smtp_port) as server:
server.starttls()
server.login(sender_email, password)
server.send_message(message)
return jsonify({"status": "success"}), 200
except Exception as e:
return jsonify({"error": str(e)}), 500Send Slack notifications
When a survey is submitted, you can send a Slack notification to a channel. Here is an example of sending Slack notifications when surveys are submitted:
from flask import Flask, request, jsonify
import requests
from datetime import datetime
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def notify_slack():
data = request.json
# Slack webhook URL
slack_webhook = "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
# Format message
message = f"""
:clipboard: *New Survey Response*
*Survey:* {data['surveyInfo']['name']}
*Submitted by:* {data['userInfo']['username']}
*Time:* {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
"""
try:
response = requests.post(slack_webhook, json={"text": message})
if response.status_code == 200:
return jsonify({"status": "success"}), 200
else:
return jsonify({"error": "Failed to send to Slack"}), 500
except Exception as e:
return jsonify({"error": str(e)}), 500Best practices
Follow these essential best practices to create effective webhook automation workflows:
- Validate webhook payloads and check for required fields before processing
- Use proper error handling with try-catch blocks and appropriate HTTP status codes
- Process webhooks asynchronously to avoid timeouts and improve performance
- Verify webhook source to ensure requests are coming from Survey123
- Implement deduplication logic since webhooks may deliver events multiple times
Resources
- For more information on webhooks in ArcGIS Enterprise, go to the Introduction to ArcGIS Enterprise webhooks.
- For more information on webhooks with a hosted feature service, go to Create a hosted feature service webhook.
- For troubleshooting webhook issues, go to the Survey123 online documentation.
- For more code samples on webhook automation, go to Survey123 GitHub repository.
Tutorials

Create a simple survey
Learn how to use ArcGIS Survey123 to create a simple survey.
Low-code/no-code

Analyze survey results
Learn how to use ArcGIS Survey123 to analyze survey results.
Low-code/no-code

Create a survey and dashboard for park maintenance
Learn how to integrate ArcGIS Survey123 with ArcGIS Dashboards to create a reporting solution.
Low-code/no-code

Create a smarter, responsive survey
Learn how to create intelligent surveys with conditional logic, hidden fields, and dynamic visibility using ArcGIS Survey123 and XLSForm.
Low-code/no-code