SetHITTypeNotification: Configure a HITType Notification

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Configure a notification to be sent when specific actions occur for the specified HITType.

Usage

1
2
SetHITTypeNotification(hit.type, notification = NULL, active = NULL, 
                       verbose = getOption('MTurkR.verbose', TRUE), ...)

Arguments

hit.type

A character string specifying the HITTypeId of the HITType for which notifications are being configured.

notification

A character string containing a URL query parameter-formatted Notification structure (e.g., returned by GenerateNotification).

active

A logical indicating whether the Notification is active or inactive.

verbose

Optionally print the results of the API request to the standard output. Default is taken from getOption('MTurkR.verbose', TRUE).

...

Additional arguments passed to request.

Details

Configure a notification to be sent to the requester whenever an event (specified in the Notification object) occurs. This is useful, for example, to enable email notifications about when assignments are submitted or HITs are completed, or for other HIT-related events.

Email notifications are useful for small projects, but configuring notifications to use the Amazon Simple Queue Service (SQS) is more reliable for large projects and allows automated processing of notifications. See examples for SQS examples. Note that using SQS requires an SQS queue with permissions configured to allow SendMessage requests from MTurk (the “principal” for MTurk is arn:aws:iam::755651556756:user/MTurk-SQS). See the MTurkR wiki for an extended tutorial.

setnotification() is an alias.

Value

A data frame containing details of the Notification and whether or not the request was successfully executed by MTurk.

Once configured, events will trigger a side effect in the form of a notification sent to the specified transport (either an email address or SQS queue). That notification will contain the following details: EventType, EventTime, HITTypeId, HITId, and (if applicable) AssignmentId.

Author(s)

Thomas J. Leeper

References

API Reference: Operation

API Reference: Concept

See Also

GenerateNotification

SendTestEventNotification

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
## Not run: 
# setup email notification
hittype <- 
RegisterHITType(title="10 Question Survey",
                description=
                "Complete a 10-question survey about news coverage and your opinions",
                reward=".20", 
                duration=seconds(hours=1), 
                keywords="survey, questionnaire, politics")

a <- GenerateNotification("[email protected]", event.type = "HITExpired")
SetHITTypeNotification(hit.type = hittype$HITTypeId, 
                       notification = a,
                       active = TRUE)
# send test notification
SendTestEventNotification(a, test.event.type="HITExpired")

## End(Not run)

## Not run: 
# setup SQS notification
hittype <- 
RegisterHITType(title="10 Question Survey",
                description=
                "Complete a 10-question survey about news coverage and your opinions",
                reward=".20", 
                duration=seconds(hours=1), 
                keywords="survey, questionnaire, politics")

b <- GenerateNotification("https://sqs.us-east-1.amazonaws.com/123456789/Example", 
                          transport = "SQS", 
                          event.type = "HITExpired")
SetHITTypeNotification(hit.type = hittype$HITTypeId, 
                       notification = b,
                       active = TRUE)
# send test notification
SendTestEventNotification(b, test.event.type="HITExpired")

## End(Not run)

MTurkR documentation built on May 29, 2017, 11:09 p.m.