Bug 1122776 - [Fedora] RFE: "web hooks" callback API
[Fedora] RFE: "web hooks" callback API
Status: CLOSED CURRENTRELEASE
Product: Zanata
Classification: Community
Component: Component-API (Show other bugs)
development
Unspecified Unspecified
unspecified Severity medium
: ---
: 3.6
Assigned To: Alex Eng
Damian Jansen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-24 00:08 EDT by Ralph Bean
Modified: 2015-03-19 03:10 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: 5
Clone Of:
Environment:
Last Closed: 2015-03-19 03:10:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ralph Bean 2014-07-24 00:08:24 EDT
This is in response to https://lists.fedoraproject.org/pipermail/infrastructure/2014-July/014619.html

It would be nice if other 3rd party services could be notified of activity happening in Zanata.  The Fedora Project's infrastructure, for instance, could potentially receive notifications about new translations and in response do any number of useful things:  prepare new releases, notify QA, or award badges of recognition to translators.

GitHub and Transifex both make this possible with "web hooks".  In the case of Transifex, you notify a Transifex API that you want to receive notifications at https://yourdomain.com/some/url/ and then later when a new translation is uploaded to Transifex.com, that web server will in turn POST some JSON payload to https://yourdomain.com/some/url/ indicating that the translation was uploaded.

We use this currently in Fedora to consume events from github and rebroadcast them on our own message bus: https://apps.fedoraproject.org/github2fedmsg

We do not currently use this to consume events from Transifex.  At present the Transifex API does not support cryptographically signed payloads -- problematic.

tf.com docs:  http://docs.transifex.com/developer/integrations/index#web-hooks
gh.com docs:  https://developer.github.com/webhooks/
Comment 1 Ralph Bean 2014-07-24 19:58:14 EDT
Just a further note on cryptographically signing the payloads.  See the information in the GitHub docs on their X-Hub-Signature header.
Comment 2 Paul W. Frields 2014-08-27 15:32:58 EDT
Since the Fedora L10n community seems fairly unified in supporting the migration of translation efforts to Zanata, it should be a priority for Zanata to offer these web hooks.  That way the Fedora message bus (fedmsg) can report and reward translation efforts across the project using the badges app, fedmsg notifications, and other capabilities.  Could this be available by the time translators start to use the system for Fedora content and packages?
Comment 3 Carlos Munoz 2014-08-27 20:47:24 EDT
I think this is a good idea in General for the integration of Zanata with other systems. We need to figure out which events need to be notified via webhooks (we could start with a very granular one similar to the one Transifex offers).

As for making it available before the proposed go-live for the Zanata Fedora instance, I don't want to commit to it before properly estimating it with the team. I am happy to raise the priority of this RFE (in JIRA) so we can take it into consideration for one of our upcoming sprints.
Comment 4 Carlos Munoz 2014-09-23 22:15:27 EDT
A webhook API in Zanata will initially allow each project to set up a post url that will accept a json payload with information on one of the following milestones:

- 100% translation for a document in a language
- 100% review for a document in a language

Zanata should try and avoid sending duplicate events whenever possible; this means that if the translation / review status of a document has not changed, another event should not be sent.

The json event payload (TBD) should include details about the document id, version, project, language and milestone reached.

Implementation details:
- These events should be handled in an asynchronous way without affecting the performance of the translation workflow.
Comment 5 Mosaab Alzoubi 2014-10-08 12:33:58 EDT
(In reply to Carlos Munoz from comment #4)
> A webhook API in Zanata will initially allow each project to set up a post
> url that will accept a json payload with information on one of the following
> milestones:
> 
> - 100% translation for a document in a language
> - 100% review for a document in a language
> 
> Zanata should try and avoid sending duplicate events whenever possible; this
> means that if the translation / review status of a document has not changed,
> another event should not be sent.
> 
> The json event payload (TBD) should include details about the document id,
> version, project, language and milestone reached.
> 
> Implementation details:
> - These events should be handled in an asynchronous way without affecting
> the performance of the translation workflow.

Hi all..

I don't think that is a right way to rank only 100% translations, DUE TO:

1. Files aren't ZERO content, then only commiter reach 100% getting all thanx!!
2. Files have many commiters not one!!
3. Files aren't equal!! Some LARGE and some SMALL!!

So I think the best way to use that calculating number of words that translated like Transifex do.

Regards
Comment 6 Carlos Munoz 2014-10-08 19:55:13 EDT
(In reply to Mosaab Alzoubi from comment #5)
Hi Mosaab,

I'm not sure I understand the nature of your concerns. While I do agree that files have many commiters and can vary in size, the purpose of this web hook is to signal the completion of a file, not to provide any sort of overall statistics on project completion (there's a Rest API for that).

The webhook should serve a notification to an external party, communicating a milestone has been reached (in this case the completion of a document), so that the external party can then trigger some other actions from its side; like, say, getting up-to-date statistics on the project.

Let me know if I misunderstood your points.

> Hi all..
> 
> I don't think that is a right way to rank only 100% translations, DUE TO:
> 
> 1. Files aren't ZERO content, then only commiter reach 100% getting all
> thanx!!
> 2. Files have many commiters not one!!
> 3. Files aren't equal!! Some LARGE and some SMALL!!
> 
> So I think the best way to use that calculating number of words that
> translated like Transifex do.
> 
> Regards
Comment 7 Mosaab Alzoubi 2014-10-16 02:48:06 EDT
(In reply to Carlos Munoz from comment #6)
> (In reply to Mosaab Alzoubi from comment #5)
> Hi Mosaab,
> 
> I'm not sure I understand the nature of your concerns. While I do agree that
> files have many commiters and can vary in size, the purpose of this web hook
> is to signal the completion of a file, not to provide any sort of overall
> statistics on project completion (there's a Rest API for that).
> 
> The webhook should serve a notification to an external party, communicating
> a milestone has been reached (in this case the completion of a document), so
> that the external party can then trigger some other actions from its side;
> like, say, getting up-to-date statistics on the project.
> 
> Let me know if I misunderstood your points.
> 
> > Hi all..
> > 
> > I don't think that is a right way to rank only 100% translations, DUE TO:
> > 
> > 1. Files aren't ZERO content, then only commiter reach 100% getting all
> > thanx!!
> > 2. Files have many commiters not one!!
> > 3. Files aren't equal!! Some LARGE and some SMALL!!
> > 
> > So I think the best way to use that calculating number of words that
> > translated like Transifex do.
> > 
> > Regards


Then non-completed files can't included ?!
Comment 8 Carlos Munoz 2014-10-17 01:28:43 EDT
(In reply to Mosaab Alzoubi from comment #7)
> Then non-completed files can't included ?!

Not in the initial iteration of this feature. We may add more events in the future, like other milestones (25%, 50%, etc), new document uploads, etc. depending on requested features.
Comment 9 Ding-Yi Chen 2014-10-20 00:07:44 EDT
(In reply to Mosaab Alzoubi from comment #7)
> 
> 
> Then non-completed files can't included ?!

For projects that think 1% translated is better than 0%, they can already do it now by just pull it with client or download with WebUI. Even after web hook is developed, you can still use this method to get whatever available in Zanata.

However, we currently don't have any notification for projects that require translation to reach to a specified level (e.g. 100%). So we develop web hook to notify the 3rd party that the translation is completed.
Comment 10 Alex Eng 2014-10-21 23:36:20 EDT
Pull request:
https://github.com/zanata/zanata-server/pull/614
Comment 11 Ralph Bean 2014-10-27 19:08:57 EDT
If I can help test this anywhere, please let me know.
Comment 12 Damian Jansen 2014-11-03 01:37:45 EST
Verified

Note You need to log in before you can comment on or make changes to this bug.