Templates
Templates are the emails that are sent out by Gophish during a campaign.
The templates endpoint allows you to create, view, and manage Gophish templates.
Table of Contents
Quick Example
This example shows how to retrieve the name of every template in Gophish.
Models
gophish.models.Attachment
Attributes
content
(str) The base64 encoded attachment contenttype
(str) The content type of the attachmentname
(str) The attachment filename
Methods
__init__(self, **kwargs)
- Returns a new Attachment
Example:
gophish.models.Template
A template contains a name and the email content.
Attributes
id
(int) The template IDname
(str) The template namehtml
(str) The template HTMLtext
(str) The template HTMLmodified_date
(optional: datetime.datetime) The scheduled time for template launchattachments
(list(models.Attachment)) The optional email attachments
Methods
__init__(self, **kwargs)
- Returns a new Template
Example:
Methods
gophish.api.templates.get(template_id=None)
Gets the details for one or more templates. To get a particular template, set the ID to the template ID.
If the template_id
is not set, all templates owned by the current user will be returned.
Returns
If the
template
is set:models.Template
If
template_id
isNone
:list(models.Template)
gophish.api.templates.post(template)
Creates a new template. This endpoint requires you to submit a gophish.models.Template
object.
Returns
The gophish.models.Template
object that was created.
gophish.api.templates.put(template)
Edits an existing template. This endpoint requires you to submit an existing gophish.models.Template
object with its id
attribute set correctly.
Returns
The gophish.models.Template
object that was edited.
gophish.api.templates.delete(template_id)
Deletes the template specified by template_id
.
Returns
A gophish.models.Status
message.
Examples
Here are some examples to show how to use the API.
All of these examples assume the following setup:
Get All Templates
Get Single Template
Create New Template
Last updated