tencent cloud


Custom Invitation

Last updated: 2021-01-29 16:19:03


    This document describes how to use SCF in combination with API Gateway to customize an invitation, so that you can generate an invitation simply by entering the guest name.


    Creating bucket

    A bucket is used to store custom invitations. The specific steps are as follows:

    1. Log in to the COS console and select Bucket List on the left sidebar.
    2. Click Create Bucket on the Bucket List page.
    3. In the Create Bucket pop-up window, create a bucket as shown below:

      The main parameter information is as follows. Keep the remaining parameters as default:
      • Name: enter a custom name. This document uses test as an example.
      • Region: select Guangzhou.
      • Access Permission: select Public Read/Private Write.
    4. Click OK.
    5. Select Security Management on the left of the bucket and click Add a Rule in "CORS (Cross-Origin Resource Sharing) Setting".
    6. In the Add CORS Rule pop-up window, add a rule.
      The main parameter information is as follows. Keep the remaining parameters as default:
      • Origin: enter *.
      • Allow-Methods: select GET.
      • Expose-Headers: enter -.
    7. Click Submit.

    Creating function and API Gateway trigger

    1. Log in to the SCF console and select Function Service on the left sidebar.
    2. At the top of the Function Service page, select the Guangzhou region and click Create to enter the function creating page.
    3. Follow the procedure below to search for the custom invitation template as shown below. This document uses Python 2.7 as an example:
      • Creation method: select Function Template.
      • Fuzzy search: enter CustomInvitation and search.
        Click Learn More in the template to view relevant information in the Template Details pop-up window, which can be downloaded.
    4. Click Next. The function name is automatically generated by default and can be modified as needed. Follow the prompts to enter the corresponding values of the environment variables required by the template in the Basic Configurations section and keep other parameters as default.
      Configure environment variables as shown below:
      regionBucket region, which starts with `ap-` and ends with the region name.
      target_bucketName of the created bucket.
      target_pathPath of the destination bucket. To view the directory path of the bucket for storing invitations, please go to **Bucket List** and **enter the corresponding bucket**. For example, if the directory is `example`, the destination path here is `/example`. If there is no directory created in the bucket, enter `/` here.


    This example requires SCF to have the operation permissions of COS. Execution Role has been enabled by default, and an execution role has been automatically created and associated with the required COS permission policy QcloudCOSFullAccess. If you need to make adjustments, please select Use the existing role or disable Execution Role.

    1. Click Complete.

    Generating invitation

    You can generate an invitation in two ways:


    You can get the access path of the API Gateway trigger on the Trigger Management page.

    Method 1

    Run the following command on the command line.

    curl API gateway trigger URL  -d 'Name of the invited guest'

    The download address of the invitation can be obtained on the device, such as:

    curl https://service-xxxx.gz.apigw.tencentcs.com/release/test-123456 -d 'name'

    Method 2

    1. Download the HTML page and change the URL to the URL of the API gateway trigger.
    2. Open the HTML page, enter the name of the invited guest to generate a poster, and access the URL to download it.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support