Skip to content

Examples of servers to listen for and process webhooks from SurveyLegend

Notifications You must be signed in to change notification settings

SurveyLegend/webhook-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webhook-examples

Examples of servers to listen for and process webhooks from SurveyLegend

Note: It's necessary to have an IP or URL that is accessible from the Internet for SurveyLegend webhook processing service or SurveyLegend app to reach the server.

Node.js

  1. Copy and rename .env.example to .env, modify environment variables.
  2. Run npm install in terminal

Node HTTP

  1. Run npm run http in terminal
  2. Enter url in SurveyLegend app

Express.js

  1. Run npm run express in terminal
  2. Enter url in SurveyLegend app

Hapi.js

  1. Run npm run hapi in terminal
  2. Enter url in SurveyLegend app

PHP

API Usage Examples

These examples are meant to be run from the command-line like so and usually require an API-key. php examples/script.php --apikey=XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX

Get survey list for user

Run php ./php/examples/get_survey_list.php --apikey=XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX

Get specific survey

Note that no API-key is necessary, surveys are available publicly otherwise they wouldn't load when someone wants to participate.

Run php ./php/examples/get_survey.php --survey_id=#######

Get responses for specific survey

Run php ./php/examples/get_responses_for_survey.php --apikey=XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX --survey_id=#######

Get responses for specific survey

Run php ./php/examples/get_response.php --apikey=XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX --response_id=#######

Webhook Examples

To use a PHP script for receiving a web-server such as Nginx, Apache or similar is necessary. The server must also be configured to respond to requests coming from the Internet and to run PHP scripts.

TODO: Create script for handling incoming webhook call.

Python

API Usage Examples

These examples are meant to be run from the command-line like so and usually require an API-key. python python/examples.py --apikey=XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX --limit=3

Include get survey list for user, iterating and getting surveys

Webhook Examples

To use a Python script for receiving a web-server such as Nginx, Apache or similar is necessary, a Python based server can also be used. The server must also be configured to respond to requests coming from the Internet and to run Python scripts.

TODO: Create script for handling incoming webhook call.

About

Examples of servers to listen for and process webhooks from SurveyLegend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published