(Updated on 2022-06-01) Please note that this document is outdated and no longer maintained. For an up-to-date introduction to system accounts, please visit the SeaTalk Open Platform official documentation website here.
Provide a method for you to automatically send messages to group chats based on Webhook protocol.
System accounts can only be used in group chats.
Go to the group where you want to create a System Account, open the group chat setting, find System Accounts, and click Add System Account.
Note:
- You can create up to 15 system accounts in each group.
- Currently, only Seatalk Desktop supports the creation of system accounts.
- Group owner can add account admins to allow them to create system accounts in the group.
System Accounts need to be configured after being added. You will be given a unique webhook similar to the example below:
https://openapi.seatalk.io/webhook/group/xxxxxxxxxxxxxxxxxxxxxx
Use the webhook by sending an HTTP POST request to webhook URL as the below example:
curl -i -X POST -H 'Content-Type: application/json' -d '{ "tag": "text", "text": {"content": "Hello World!"}}' https://openapi.seatalk.io/webhook/group/xxxxxxxxxxxxxxxxxxxxxx
The System Account use the following body format (JSON) to send a text message:
{
"tag": "text",
"text": {
"content": "You’ve got a new event invitation. Please check it from your Google Calendar.",
"mentioned_list": ["1706829708"],
"mentioned_email_list": ["wenxuanmo@seagroup.com"],
"at_all": true
}
}
Parameter | Required | Description |
---|---|---|
tag | true | Message type. Fixed to text to send a text message. |
content | true | Text content. The longest does not exceed 4096 bytes. UTF8 encoding format. |
mentioned_list | false | List of SeaTalk IDs (string: should be group member). Mention certain group members corresponding to SeaTalk IDs (@ xxx) |
mentioned_email_list | false | List of Emails (string: should be group member). Mention certain group members corresponding to SeaTalk registered emails (@ xxx) |
at_all | false | If at_all = true, the message will @all group members |
The System Account use the following body format (JSON) to send a image message:
{
"tag": "image",
"image_base64": {
"content": "iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFElEQVQYV2P8/uPnfwYGBgZGGAMAVe4H0WDm+2kAAAAASUVORK5CYII="
}
}
Parameter | Required | Description |
---|---|---|
tag | true | Message type. Use image to send a image message. |
content | true | Base64-encoded image file (smaller than 5MB after encoding). For now, only PNG, JPG and GIF images are supported. |
Example in Python Language (Sending Image Message)
BOT_WEBHOOK_URL: Text = "https://openapi.seatalk.io/webhook/group/xxxxxxxxxxxxxxxxxxxxxx"
json_payload: Dict
with open("example.gif", "rb") as f:
raw_image_content: bytes = f.read()
base64_encoded_image: str = base64.b64encode(raw_image_content).decode("latin-1")
json_payload = {"tag": "image","image_base64": {"content": base64_encoded_image}}
httpx.post(url=BOT_WEBHOOK_URL, json=json_payload)
Each System Account can send at most 60 messages per minute.
Note:
- The excessive part will fail to be sent.
- Then the System Account will enter a 10-minute silence period. After 10 minutes, it can continue to send messages.
Error Code | Error Message |
---|---|
1 | Invalid Webhook URL. |
2 | It's not active. |
3 | Message exceeds maximum length. |
4 | Message cannot be empty . |
5 | Image file exceeds the maximum size limit. |
Go to group chat settings - System Accounts, click on an existing system account and then click Delete System Account in the lower left corner.