Skip to content

Create Template

POST /public/template

Create a new reusable automation template containing comment moderation, replies, likes, direct messages, stories, and chat rules.

Endpoint Details

  • Authentication: Basic Auth (Authorization: Basic Base64(AccessKey:SecretKey))
  • Access Tier: Gold+

Request Body

Automation Configuration Guide

For a detailed explanation of all automation modules, schemas, and examples, see the Automation Configuration Guide.

FieldTypeRequiredDescription
namestringYesName of the automation template.
configobjectYesAutomation configuration object (see below).

Config Object

FieldTypeRequiredDescription
deleteobjectYesConfiguration for delete comment automation.
replyobjectYesConfiguration for reply comment automation.
likeobjectYesConfiguration for like comment automation.
messageobjectYesConfiguration for DM comment automation.
chatobjectYesConfiguration for chat automation.
storyobjectYesConfiguration for story automation.

Delete Object

FieldTypeRequiredDescription
isActivebooleanYesWhether delete automation is active.
typestringNoDelete type. Options: keyword, ai.
keywordsstring[]NoKeywords that trigger comment deletion (used when type is keyword).
promptstringNoAI prompt for determining which comments to delete (used when type is ai).

Reply Object

FieldTypeRequiredDescription
isActivebooleanYesWhether reply automation is active.
typestringNoReply type. Options: text, keyword, ai.
textstringNoStatic reply text (used when type is text).
promptstringNoAI prompt for generating reply text (used when type is ai).
isIncludeContentContextbooleanNoWhether to include the content context in AI prompt.
keywordobjectNoKeyword-based reply configuration (used when type is keyword).
keyword.isExactMatchbooleanNoWhether to match keywords exactly.
keyword.valuesarrayNoArray of keyword-reply pairs.
keyword.values[].keywordstringNoTrigger keyword.
keyword.values[].textstringNoReply text for this keyword.
conditionobjectNoCondition to trigger reply.
condition.isActivebooleanNoWhether condition is active.
condition.isExactMatchbooleanNoWhether to match condition keywords exactly.
condition.keywordsstring[]NoCondition keywords.
exceptionobjectNoException rule configuration to ignore certain comments.
exception.isActivebooleanNoWhether exception rule is active.
exception.isExactMatchbooleanNoWhether to match exception keywords exactly.
exception.keywordsstring[]NoException keywords.
delayobjectNoDelay configuration before replying.
delay.isActivebooleanNoWhether delay is active.
delay.valuenumberNoDelay value.
delay.typestringNoDelay unit. Options: second, minute.

Like Object

FieldTypeRequiredDescription
isActivebooleanYesWhether like automation is active.

Message Object

FieldTypeRequiredDescription
isActivebooleanYesWhether DM automation is active.
typestringNoMessage type. Options: text, keyword, ai, opening.
textstringNoStatic message text (used when type is text).
promptstringNoAI prompt for generating messages (used when type is ai).
openingobjectNoOpening message configuration.
opening.postbackobjectNoPostback button opening configuration.
opening.postback.isActivebooleanNoWhether postback opening is active.
opening.postback.textstringNoOpening text message.
opening.postback.imagestringNoOpening image URL.
opening.postback.buttonobjectNoPostback button configuration.
opening.postback.button.typestringNoButton type. Options: postback, web_url.
opening.postback.button.titlestringNoButton title text.
opening.postback.button.payloadstringNoButton payload identifier.
opening.postback.button.urlstringNoButton URL.
opening.additionalobjectNoAdditional opening configuration.
opening.additional.isActivebooleanNoWhether additional opening is active.
opening.additional.isPreventBeforeFollowbooleanNoWhether to prevent message before user follows.
opening.additional.textstringNoAdditional opening text.
opening.additional.imagestringNoAdditional opening image URL.
opening.additional.buttonobjectNoAdditional button configuration (same as postback button).
opening.webUrlobjectNoWeb URL opening configuration.
opening.webUrl.textstringNoWeb URL opening text.
opening.webUrl.imagestringNoWeb URL opening image URL.
opening.webUrl.buttonsarrayNoArray of web URL buttons (same structure as postback button).
keywordobjectNoKeyword-based message config (same structure as Reply keyword).
conditionobjectNoCondition config (same structure as Reply condition).
delayobjectNoDelay config (same structure as Reply delay).

Chat Object

FieldTypeRequiredDescription
isActivebooleanYesWhether chat automation is active.
typestringNoChat response mode. Options: text, keyword, ai.
textstringNoStatic response text (used when type is text).
promptstringNoAI prompt for generating responses (used when type is ai).
keywordobjectNoKeyword-based chat config (same structure as Reply keyword).
delayobjectNoDelay config before responding (same structure as Reply delay).

Story Object

Same structure as Message Object.

Example Request

bash
curl -X POST "https://api.repliz.com/public/template" \
  -H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Auto Comment",
    "config": {
      "delete": {
        "isActive": true,
        "type": "keyword",
        "keywords": ["Jobless"],
        "prompt": ""
      },
      "reply": {
        "isActive": true,
        "type": "text",
        "text": "Thanks for comment",
        "prompt": "",
        "isIncludeContentContext": false,
        "keyword": {
          "isExactMatch": false,
          "values": []
        },
        "condition": {
          "isActive": false,
          "isExactMatch": false,
          "keywords": []
        },
        "exception": {
          "isActive": false,
          "isExactMatch": false,
          "keywords": []
        },
        "delay": {
          "isActive": false,
          "value": 10,
          "type": "second"
        }
      },
      "like": {
        "isActive": true
      },
      "message": {
        "isActive": true,
        "type": "text",
        "text": "Thanks for comment, here we are",
        "prompt": "",
        "opening": {
          "postback": {
            "isActive": false,
            "text": "",
            "image": "",
            "file": null,
            "button": {
              "type": "postback",
              "title": "",
              "payload": ""
            }
          },
          "additional": {
            "isActive": false,
            "isPreventBeforeFollow": false,
            "text": "",
            "image": "",
            "file": null,
            "button": {
              "type": "postback",
              "title": "",
              "payload": ""
            }
          },
          "webUrl": {
            "text": "",
            "image": "",
            "file": null,
            "buttons": []
          }
        },
        "keyword": {
          "isExactMatch": false,
          "values": []
        },
        "condition": {
          "isActive": false,
          "isExactMatch": false,
          "keywords": []
        },
        "delay": {
          "isActive": false,
          "value": 10,
          "type": "second"
        }
      },
      "story": {
        "isActive": true,
        "type": "text",
        "text": "Like this story?",
        "prompt": "",
        "opening": {
          "postback": {
            "isActive": false,
            "text": "",
            "image": "",
            "file": null,
            "button": {
              "type": "postback",
              "title": "",
              "payload": ""
            }
          },
          "additional": {
            "isActive": false,
            "isPreventBeforeFollow": false,
            "text": "",
            "image": "",
            "file": null,
            "button": {
              "type": "postback",
              "title": "",
              "payload": ""
            }
          },
          "webUrl": {
            "text": "",
            "image": "",
            "file": null,
            "buttons": []
          }
        },
        "keyword": {
          "isExactMatch": false,
          "values": []
        },
        "condition": {
          "isActive": false,
          "isExactMatch": false,
          "keywords": []
        },
        "delay": {
          "isActive": false,
          "value": 10,
          "type": "second"
        }
      },
      "chat": {
        "isActive": true,
        "type": "text",
        "text": "For information, please call a book on website",
        "prompt": "",
        "keyword": {
          "isExactMatch": false,
          "values": []
        },
        "delay": {
          "isActive": false,
          "value": 10,
          "type": "second"
        }
      }
    }
  }'
javascript
import axios from 'axios';

const response = await axios.post(
  'https://api.repliz.com/public/template',
  {
    name: 'Auto Comment',
    config: {
      delete: {
        isActive: true,
        type: 'keyword',
        keywords: ['Jobless'],
        prompt: '',
      },
      reply: {
        isActive: true,
        type: 'text',
        text: 'Thanks for comment',
        prompt: '',
        isIncludeContentContext: false,
        keyword: {
          isExactMatch: false,
          values: [],
        },
        condition: {
          isActive: false,
          isExactMatch: false,
          keywords: [],
        },
        exception: {
          isActive: false,
          isExactMatch: false,
          keywords: [],
        },
        delay: {
          isActive: false,
          value: 10,
          type: 'second',
        },
      },
      like: {
        isActive: true,
      },
      message: {
        isActive: true,
        type: 'text',
        text: 'Thanks for comment, here we are',
        prompt: '',
        opening: {
          postback: {
            isActive: false,
            text: '',
            image: '',
            file: null,
            button: {
              type: 'postback',
              title: '',
              payload: '',
            },
          },
          additional: {
            isActive: false,
            isPreventBeforeFollow: false,
            text: '',
            image: '',
            file: null,
            button: {
              type: 'postback',
              title: '',
              payload: '',
            },
          },
          webUrl: {
            text: '',
            image: '',
            file: null,
            buttons: [],
          },
        },
        keyword: {
          isExactMatch: false,
          values: [],
        },
        condition: {
          isActive: false,
          isExactMatch: false,
          keywords: [],
        },
        delay: {
          isActive: false,
          value: 10,
          type: 'second',
        },
      },
      story: {
        isActive: true,
        type: 'text',
        text: 'Like this story?',
        prompt: '',
        opening: {
          postback: {
            isActive: false,
            text: '',
            image: '',
            file: null,
            button: {
              type: 'postback',
              title: '',
              payload: '',
            },
          },
          additional: {
            isActive: false,
            isPreventBeforeFollow: false,
            text: '',
            image: '',
            file: null,
            button: {
              type: 'postback',
              title: '',
              payload: '',
            },
          },
          webUrl: {
            text: '',
            image: '',
            file: null,
            buttons: [],
          },
        },
        keyword: {
          isExactMatch: false,
          values: [],
        },
        condition: {
          isActive: false,
          isExactMatch: false,
          keywords: [],
        },
        delay: {
          isActive: false,
          value: 10,
          type: 'second',
        },
      },
      chat: {
        isActive: true,
        type: 'text',
        text: 'For information, please call a book on website',
        prompt: '',
        keyword: {
          isExactMatch: false,
          values: [],
        },
        delay: {
          isActive: false,
          value: 10,
          type: 'second',
        },
      },
    },
  },
  {
    auth: {
      username: 'YOUR_ACCESS_KEY',
      password: 'YOUR_SECRET_KEY',
    },
  },
);

console.log(response.data);
javascript
const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');

const response = await fetch('https://api.repliz.com/public/template', {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Auto Comment',
    config: {
      delete: {
        isActive: true,
        type: 'keyword',
        keywords: ['Jobless'],
        prompt: '',
      },
      reply: {
        isActive: true,
        type: 'text',
        text: 'Thanks for comment',
        prompt: '',
        isIncludeContentContext: false,
        keyword: {
          isExactMatch: false,
          values: [],
        },
        condition: {
          isActive: false,
          isExactMatch: false,
          keywords: [],
        },
        exception: {
          isActive: false,
          isExactMatch: false,
          keywords: [],
        },
        delay: {
          isActive: false,
          value: 10,
          type: 'second',
        },
      },
      like: {
        isActive: true,
      },
      message: {
        isActive: true,
        type: 'text',
        text: 'Thanks for comment, here we are',
        prompt: '',
        opening: {
          postback: {
            isActive: false,
            text: '',
            image: '',
            file: null,
            button: {
              type: 'postback',
              title: '',
              payload: '',
            },
          },
          additional: {
            isActive: false,
            isPreventBeforeFollow: false,
            text: '',
            image: '',
            file: null,
            button: {
              type: 'postback',
              title: '',
              payload: '',
            },
          },
          webUrl: {
            text: '',
            image: '',
            file: null,
            buttons: [],
          },
        },
        keyword: {
          isExactMatch: false,
          values: [],
        },
        condition: {
          isActive: false,
          isExactMatch: false,
          keywords: [],
        },
        delay: {
          isActive: false,
          value: 10,
          type: 'second',
        },
      },
      story: {
        isActive: true,
        type: 'text',
        text: 'Like this story?',
        prompt: '',
        opening: {
          postback: {
            isActive: false,
            text: '',
            image: '',
            file: null,
            button: {
              type: 'postback',
              title: '',
              payload: '',
            },
          },
          additional: {
            isActive: false,
            isPreventBeforeFollow: false,
            text: '',
            image: '',
            file: null,
            button: {
              type: 'postback',
              title: '',
              payload: '',
            },
          },
          webUrl: {
            text: '',
            image: '',
            file: null,
            buttons: [],
          },
        },
        keyword: {
          isExactMatch: false,
          values: [],
        },
        condition: {
          isActive: false,
          isExactMatch: false,
          keywords: [],
        },
        delay: {
          isActive: false,
          value: 10,
          type: 'second',
        },
      },
      chat: {
        isActive: true,
        type: 'text',
        text: 'For information, please call a book on website',
        prompt: '',
        keyword: {
          isExactMatch: false,
          values: [],
        },
        delay: {
          isActive: false,
          value: 10,
          type: 'second',
        },
      },
    },
  }),
});

const data = await response.json();
console.log(data);

Response

json
{
  "_id": "6a912e6c8133bfb870b220d3"
}
json
{
  "code": 401,
  "message": "unauthorized"
}