# getWXContext

Gets WeChat call context in cloud function. This does not require an incoming parameter, and returns the following fields:

Fields Description Prerequisite Minimum Version
OPENID Mini Program user openid When a cloud function is called on Mini Program
APPID Mini Program AppID When a cloud function is called on Mini Program
UNIONID Mini Program user unionid When a cloud function is called on Mini Program and when unionid can be obtained
ENV Environment ID of a cloud function None 0.6.0

# Use Case

const cloud = require('wx-server-sdk')

exports.main = async (event, context) => {
  const {
    OPENID,
    APPID,
    UNIONID,
    ENV,
  } = cloud.getWXContext()

  return {
    OPENID,
    APPID,
    UNIONID,
    ENV,
  }
}