Pgyer Docs
Integrations & Notifications

Webhook Configuration

Push Pgyer app events to a URL of your choice, or integrate with WeCom, DingTalk, and Lark group bots via Webhook.

A webhook is a mechanism for customizing the behavior of a web app via user-supplied callbacks, maintained by the third-party developer. Pgyer uses webhooks to push a message to the URL you specify whenever a given event happens, wiring Pgyer into another platform or website. For example, when you upload a new version, Pgyer pushes the corresponding message to your URL.

Pgyer webhooks support events for app updates, version management, app settings, app migration, and app deletion. Payload examples for some of these events are below.

Prerequisites

  • An app already uploaded to Pgyer.
  • A URL that can receive the message: either a service you've built yourself, or a group bot webhook URL issued by WeCom / DingTalk / Lark.

Webhook Types

Pick a type when creating a webhook — the type determines the payload format Pgyer uses:

TypeDescription
OtherPushes raw JSON to your own service endpoint. See Data Protocol below for the field layout.
WeCom group botPushes messages in WeCom bot format to the specified group.
DingTalk group botPushes messages in DingTalk bot format to the specified group.
Lark group botPushes messages in Lark bot format to the specified group.

For group-bot types, Pgyer adapts the message to the platform's format for you — no conversion needed on your side.

Events You Can Subscribe To

When creating a webhook, the Select events to push section offers:

EventTrigger
App updateA new version of the app is uploaded.
Version managementAny version is edited, shown / hidden, or deleted.
App settingsAny change to app settings.
App migrationThe app is migrated to another account.
App deletionThe app is deleted.

Create a Webhook

  1. Basics. Open Settings → Webhook Settings in the app, click Create Webhook, set the Name, and choose the target platform under Webhook Type.
  2. URL. Enter the URL that should receive messages. For group bots, paste the webhook URL issued by the corresponding platform.
  3. Events and status. In Select events to push, check the events you want; under @mention members, decide whether group-bot messages should @ members (applies to group bots only); set Webhook status to Enabled and click Save.

Once saved, Pgyer will push messages to the URL when the chosen events fire.

An app can have up to three webhooks — repeat the steps above to add more.

Data Protocol

Pgyer sends events as an HTTP POST request with Content-Type: application/json and a JSON body.

When a new version is uploaded, the payload looks like this (actual values vary):

{
  "action": "应用更新",
  "title": "OooPlay",
  "link": "https://www.pgyer.com/oooplay_test",
  "message": "您的应用OooPlay有了新的版本(2.4)更新。",
  "type": "updateVersion",
  "os_version": "2.4",
  "build_version": "139",
  "created": "2015-10-09 11:25:16",
  "updated": "2015-10-09 11:25:16",
  "timestamp": 1444361118,
  "appsize": "2238036",
  "device_type": "iOS",
  "notes": "修复了若干已知问题"
}

Field Reference

FieldTypeDescription
actionstringEvent name, e.g. 应用更新 (app update).
typestringEnglish identifier for programmatic routing — for an app update it's updateVersion.
titlestringApp name.
linkstringDownload page URL for the app on Pgyer.
messagestringHuman-readable message; also used as the default body of group-bot messages.
os_versionstringApp version (i.e. versionName), not the OS version — the field name is a historical artifact.
build_versionstringApp build number (iOS CFBundleVersion or Android versionCode).
createdstringEvent creation time in YYYY-MM-DD HH:MM:SS format.
updatedstringEvent update time, same format.
timestampintegerEvent Unix timestamp in seconds.
appsizestringInstaller size in bytes.
device_typestringPlatform the app targets; typically iOS or Android.
notesstringExtra content — the release notes for an app-update event.

On the server, read the raw POST body to get the message. In PHP, for example:

$data = file_get_contents('php://input');

Decode it as JSON to parse the fields:

$info = json_decode($data, true);

From there, handle it however you need — append to a message stream, post to a notification center, etc.

WeCom Group Bot

  1. Open WeCom and go to the group that should receive messages.
  2. Open the group menu, choose Add Group Bot → Add Bot, name the bot, and finish creating it.
  3. Copy the webhook URL assigned to the bot, then paste it into the URL field on Pgyer's webhook creation page.

DingTalk Group Bot

  1. Open the settings in the top right of the group chat and go to Smart Group Assistant.
  2. Tap Add → Custom Bot, name the bot, set Security Settings → Custom Keyword to 应用, and finish.
  3. Copy the webhook URL assigned to the bot and paste it into the URL field on Pgyer's webhook creation page.

The keyword must be 应用 because Pgyer's push messages always contain the characters "应用" — setting this keyword is what lets the messages pass DingTalk's security check. Without it, DingTalk will reject the messages.

Lark Group Bot

  1. Open Group settings → Group bots → Add bot, choose Custom bot, and add it.
  2. Enter a name and description for the bot, then click Next.
  3. Set Security settings → Custom keyword to 应用, copy the webhook URL, and click Finish.
  4. Back on Pgyer's webhook creation page, paste the URL you copied into the URL field.

The keyword is also 应用 for the same reason as DingTalk: Pgyer's push messages contain "应用", and this keyword is what lets them pass Lark's security check.

On this page