(9 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
API
 
API
 
===Type===
 
===Type===
email
+
FlexFormBot
 
===Synopsis===
 
===Synopsis===
Send an email using the API.
+
Trigger a FlexForm action.
 
===Description===
 
===Description===
 
Trigger a FlexForm action. Currently only the email trigger is available.
 
Trigger a FlexForm action. Currently only the email trigger is available.
  
 
===Parameters===
 
===Parameters===
trigger - What function needs to be triggered within FlexForm. This parameter is required.
+
'''trigger''' - What function needs to be triggered within FlexForm. This parameter is required.
data - Extra data needed for the Trigger function. Depends on the trigger action. Please read the manual for more information.  
+
 
title - Title needed for the Trigger function. Depends on the trigger action. Please read the manual for more information.  
+
'''data''' - Extra data needed for the Trigger function. Depends on the trigger action. Please read the manual for more information.  
token - A "csrf" token retrieved from action=query&meta=tokens. This parameter is required.
+
 
 +
'''title''' - Title needed for the Trigger function. Depends on the trigger action. Please read the manual for more information.  
 +
 
 +
'''token''' - A "'''csrf'''" token retrieved from action=query&meta=tokens. This parameter is required.
  
 
====Trigger email====
 
====Trigger email====
With this trigger you can send an email, based on the email-template.
+
With this trigger you can send an email, based on the email-template.  
 +
 
 
The email trigger also needs a title of a page. That page needs to be setup as a full email template. Read the docs "email" on how to setup such a template.  
 
The email trigger also needs a title of a page. That page needs to be setup as a full email template. Read the docs "email" on how to setup such a template.  
  
 +
Additionally, you can use the data attribute to add BCC addresses to an email. Format is a JSON 
  
 +
<code>{ "bcc": "Charlot [charlot@wikibase.nl], Ad [ad@wikibase.nl]" }</code>
 
===Example===
 
===Example===
 
Make a call using the csrf token to the MediaWiki API
 
Make a call using the csrf token to the MediaWiki API
<syntaxhighlight lang="api">
+
<syntaxhighlight>
 
   To = api.php
 
   To = api.php
 
   action = FlexFormBot
 
   action = FlexFormBot
 
   trigger = email
 
   trigger = email
 
   title = Email template page
 
   title = Email template page
 +
  token = <your csrf token>
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 33: Line 40:
 
Example of an error
 
Example of an error
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
  {
+
{
 
     "FlexFormBot": {
 
     "FlexFormBot": {
 
         "error": {
 
         "error": {
             "message": "The page you specified doesn't exist."
+
             "message": "The page you specified doesn't exist.",
 +
            "request": {
 +
                "trigger": "email",
 +
                "title": "Email_template_tsest",
 +
                "data": null
 +
            }
 
         }
 
         }
 
     }
 
     }
Line 44: Line 56:
 
Example of success
 
Example of success
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
  {
+
{
 
     "FlexFormBot": {
 
     "FlexFormBot": {
 
         "result": {
 
         "result": {
             "success"
+
             "request": {
 +
                "trigger": "email",
 +
                "title": "Email_template_test",
 +
                "data": null
 +
            },
 +
            "message": "success"
 
         }
 
         }
 
     }
 
     }
Line 53: Line 70:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
===Note===
 
===Note===
You need to add the csrf token with every request to FlexFormBot  
+
You need to add the csrf token with every request to FlexFormBot
===Links===
 
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
 
ws-class-props
Line 1: Line 1:
 
+
{{Doc properties
 +
|Doc subject=DevOps:Doc/FlexForm
 +
|Subject version=1.1,2.0,2.1
 +
|Doc parent=DevOps:Doc/FlexForm/1.1/API
 +
|Doc sort order=10
 +
|Doc target group=Developer
 +
|Doc synopsis=Trigger a FlexForm action
 +
}}
ws-page-props
Line 1: Line 1:
{{Doc properties
+
 
|Doc subject=DevOps:Doc/FlexForm
 
|Subject version=1.0.1
 
|Doc parent=DevOps:Doc/FlexForm/1.0.1/API
 
|Doc sort order=10
 
|Doc target group=User
 
}}
 

Latest revision as of 22:14, 31 March 2023

Name

API

Type

FlexFormBot

Synopsis

Trigger a FlexForm action.

Description

Trigger a FlexForm action. Currently only the email trigger is available.

Parameters

trigger - What function needs to be triggered within FlexForm. This parameter is required.

data - Extra data needed for the Trigger function. Depends on the trigger action. Please read the manual for more information.

title - Title needed for the Trigger function. Depends on the trigger action. Please read the manual for more information.

token - A "csrf" token retrieved from action=query&meta=tokens. This parameter is required.

Trigger email

With this trigger you can send an email, based on the email-template.

The email trigger also needs a title of a page. That page needs to be setup as a full email template. Read the docs "email" on how to setup such a template.

Additionally, you can use the data attribute to add BCC addresses to an email. Format is a JSON

{ "bcc": "Charlot [charlot@wikibase.nl], Ad [ad@wikibase.nl]" }

Example

Make a call using the csrf token to the MediaWiki API

  To = api.php
  action = FlexFormBot
  trigger = email
  title = Email template page
  token = <your csrf token>

Return format

The API result will be in a JSON format. When an error occurs, you will have an error field present where you can read its message.

Example of an error

{
    "FlexFormBot": {
        "error": {
            "message": "The page you specified doesn't exist.",
            "request": {
                "trigger": "email",
                "title": "Email_template_tsest",
                "data": null
            }
        }
    }
}

Example of success

{
    "FlexFormBot": {
        "result": {
            "request": {
                "trigger": "email",
                "title": "Email_template_test",
                "data": null
            },
            "message": "success"
        }
    }
}

Note

You need to add the csrf token with every request to FlexFormBot