MeWe Open API Developer Preview

Group Agent

Group Agents are automated assistants that can help manage and interact with groups in MeWe. This app is pure backend application that is a bot that sits in a MeWe group, receives events from MeWe via webhook endpoint and can take actions via agent api. You also have to spawn the agent.

Setting up

To setup this bot you need to:

  • Setup application type of group_agent with user_gorup permission and post_content, webhookUrl also has to be added
  • Setup public webhook endpoint on your backend application

Authentication

Headers that every api request requires:

Name
Type
Description
X-App-Id
string

your application id

X-Agent-Id
string

agent it, which is userId of the agent

X-Timestamp
number

timestamp that should be the time of making the request (it protects against replay attacks), its a unix timestamp seconds

X-Signature
hex

ssignature which is hex representation of hmacSha256 signture of payload combined with headers signed with an apiKey: {appId}:{agentId}:{timestamp}:{json_payload_no_white_spaces}

Webhook events

Group agent app can receive events via webhooks. All webhooks calls will be authenticated similar way as app has to authenticate api calls, however its up to developer if should be checked or not. It will have a bit different headers and the signature payload: no X-App-Id but X-Event instead which is unique event name, X-Agent-Id, X-Timestamp, X-Signature stays the same. Signature formula: {timestamp}:{agentId}:{eventType}:{json_payload_no_white_spaces}. Webhook events with example payloads:

  • group_agent_registered - triggered when a group agent is added to a group
{
  "agentName": "MuadDib",
  "groupId": "60ffe9492f19cd2677b0f1a5"
}
  • group_agent_unregistered - triggered when a group agent is removed from a group
{
  "groupId": "60ffe9492f19cd2677b0f1a5"
}
  • group_post_mention - triggered when a group agent is mentioned in a post
{
  "postId": "67b5aab656db2626cf505f8e",
  "postText": "Hey {{u_625568bf663e8f63481b04ab}MuadDib!} How's going?",
  "userId": "607595295635495b3c80f6cd",
  "userName": "Piotr Leśniewski"
} 
  • group_comment_mention - triggered when a group agent is mentioned in a comment
{
  "postId": "67b5aab656db2626cf505f8e",
  "commentId": "6890c4e77ef53700b892928b",
  "replyTo": "6890bd4c7ef53700b8928f74", //optional
  "commentText": "{{u_625568bf663e8f63481b04ab}MuadDib!} what is the best practice here?",
  "userId": "607595295635495b3c80f6cd",
  "userName": "Piotr Leśniewski"
}
  • group_chat_mention - triggered when a group agent is mentioned in a chat
{
  "chatMessageId": "6890c4e77ef53700b892927a",
  "messageText": "I dont think so {{u_625568bf663e8f63481b04ab}MuadDib!}",
  "userId": "607595295635495b3c80f6cd",
  "userName": "Piotr Leśniewski"
}
  • group_member_joined - triggered when a group member joins a group
{
  "groupId": "60ffe9492f19cd2677b0f1a5",
  "userId": "607595295635495b3c80f6cd",
  "userName": "Piotr Leśniewski"
}

Api

Endpoints that can be used in response and requires user_groups permission.

Helpful api

Was this page helpful?