Bug 1122776 - [Fedora] RFE: "web hooks" callback API
Summary: [Fedora] RFE: "web hooks" callback API
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Zanata
Classification: Retired
Component: Component-API
Version: development
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 3.6
Assignee: Alex Eng
QA Contact: Damian Jansen
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-24 04:08 UTC by Ralph Bean
Modified: 2015-03-19 07:10 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: 5
Clone Of:
Environment:
Last Closed: 2015-03-19 07:10:16 UTC
Embargoed:


Attachments (Terms of Use)

Description Ralph Bean 2014-07-24 04:08:24 UTC
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 23:58:14 UTC
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 19:32:58 UTC
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-28 00:47:24 UTC
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-24 02:15:27 UTC
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 16:33:58 UTC
(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 23:55:13 UTC
(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 06:48:06 UTC
(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 05:28:43 UTC
(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 04:07:44 UTC
(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-22 03:36:20 UTC
Pull request:
https://github.com/zanata/zanata-server/pull/614

Comment 11 Ralph Bean 2014-10-27 23:08:57 UTC
If I can help test this anywhere, please let me know.

Comment 12 Damian Jansen 2014-11-03 06:37:45 UTC
Verified


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