ws-seo
Line 2: Line 2:
 
|Title=FlexForm Bot API function
 
|Title=FlexForm Bot API function
 
|Keywords=newsletter
 
|Keywords=newsletter
|Description=Trigger a FlexForm action. Currently only the email trigger is available. With this API function you can use FlexForm as a newsletter engine. Create a Python function or a Maintenance script that is triggered using a Cron job to send newsletters automatically utilizing the additional data attribute to have you script add the BCC email addresses.  
+
|Description=Trigger a FlexForm action. Currently only the email trigger is available. With this API function you can use FlexForm as a newsletter engine. Create a Python function or a Maintenance script that is triggered using a Cron job to send newsletters automatically utilizing the additional data attribute to have you script add the BCC email addresses.
|Section=Documentation
+
|Section=Documentation/FlexForm
 
|Published time=2023-09-06
 
|Published time=2023-09-06
 +
|Title mode=
 +
|Title separator=
 +
|Robots=
 +
|Googlebot=
 +
|Image=FlexForm logo.png
 +
|Image alt=
 +
|Image width=
 +
|Image height=
 +
|Locale=
 +
|Site name=
 +
|Author=
 
}}
 
}}

Latest revision as of 22:27, 4 November 2024

Name

API

Type

FlexFormBot

Synopsis

Trigger a FlexForm action.

Description

Trigger a FlexForm action. Currently only the email trigger is available. With this API function you can use FlexForm as a newsletter engine. Create a Python function or a Maintenance script that is triggered using a Cron job to send newsletters automatically utilizing the additional data attribute to have you script add the BCC email addresses.

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