Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.98 KB

README.md

File metadata and controls

48 lines (34 loc) · 1.98 KB

Python Code Samples

Sample code is built using Flask framework to expose APIs to consume webhook events.

The following work flows are simulated using these code samples:

  1. Update issue in Helpshift using Helpshift API on create issue event.
  2. Send Slack alert on create issue and update issue event.
  3. Create Jira ticket on issue create event and update Jira ticket on update issue event.

Requirements

This sample code is Python 2 and Python 3 compatible.

Usage

  1. Replace all placeholder values with real values in config file . Read Slack Setup , JIRA Setup and Managing your API keys for api keys for how to retrieve real values.

  2. Run setup.py file with install parameter. This will install the service dependencies.

    python setup.py install
    
  3. Start flask server.

    python app.py
    

    This will start a test server listening on port 4567.

  4. To test the server locally, we have provided some sample webhook events in the sample-payloads directory. You can directly feed these sample events to the server using curl. Note that since these are dummy payloads, the Helpshift handler will not work, and so should be commented out before running the server (see app.py). Sample payloads can be found here

cd ../sample-payloads
curl -H "Content-Type: application/json" -X POST --data @create_issue_events.json http://localhost:4567/create_issue
curl -H "Content-Type: application/json" -X POST --data @update_status_event.json http://localhost:4567/update_issue