- whenever someone needs help, she will send an email to email@example.com.
- Then there is a ruby task (rake) runs every minute to pull emails from that address (via IMAP) and create a ticket (issue) in the helpdesk project in my Redmine server.
But the thing is the Redmine's rake task can not create issue with category (Department A, Department B,...) based on the issue's content. We can only specify the fixed category beforehand in the rake command:
So, I looked around and found that Redmine has REST API. It's even greater with python-redmine, a python library to help me communicate with Redmine via the REST API:
Github repo: https://github.com/maxtepkeev/python-redmine
With the python-redmine library, I can add logic to the issue creating process. Here is how to get started with python-redmine:
1. Enable REST API in Redmine:
Go to Administration (in the top left of the screen) >> Settings >> Authentication tab >> Check the Enable REST web service checkbox
2. Get my API Key:
Go to My account (in the top right of the screen)>> Look in the right column, API access key section
Note: this user need to be a Redmine administrator to create ticket on behalf of other users.
3. Trying python-redmine:
$ pip install python-redmine
>>> from redmine import Redmine
>>> redmine_url = '<http:/myredmine.com>'
>>> myapi_key = '<myapikey>'
>>> ticket_author = '<some username>'
>>> helpdesk_project_id = '<myhelpdesk id>'
>>> service = Redmine(redmine_url, key=myapi_key, impersonate=ticket_author)
>>> newissue = service.issue.create(project_id=helpdesk_project_id, subject='This ticket is created using python redmine', description='This is genius!!!', status_id=1, category_id=1)
Now I can create a Django app with a form for people to submit helpdesk tickets in whatever category they want.
For more detail about how to using python-redmine, please read its official documentations: http://python-redmine.readthedocs.org/resources/issue.html