Notifikasi email (v3)

Cloud Talent Solution juga menawarkan API penelusuran, SearchJobsForAlert, yang disesuaikan dengan kebutuhan "pencari kerja pasif". Pencari kerja pasif adalah orang yang tidak selalu aktif mencari pekerjaan, tetapi mungkin bersedia melamar jika ada pekerjaan yang sesuai. Misalnya, pelanggan dapat memanfaatkan Cloud Talent Solution untuk mengisi konten kampanye email yang dirancang untuk menawarkan update berkala tentang pekerjaan yang mungkin diminati. Hasil SearchJobsForAlert mungkin berbeda dengan hasil dari searchJobs dan dimaksudkan untuk digunakan dalam email info lowongan terbaru dan kampanye lain yang ditargetkan untuk pencari kerja pasif. Gunakan filter tanggal diposting saat memanggil SearchJobsForAlert untuk membatasi kumpulan pekerjaan yang ditelusuri ke pekerjaan yang diposting sejak notifikasi terakhir dibuat. Untuk mengetahui informasi tambahan tentang cara menggunakan fitur ini, lihat panduan penerapan notifikasi email.

Penelusuran notifikasi email dilakukan dengan cara yang sama seperti penelusuran reguler:

Java

Untuk mengetahui informasi lebih lanjut tentang cara menginstal dan membuat klien Cloud Talent Solution, lihat Library Klien Cloud Talent Solution.


/** Search jobs for alert. */
public static void searchForAlerts(String companyName) throws IOException, InterruptedException {
  // Make sure to set the requestMetadata the same as the associated search request
  RequestMetadata requestMetadata =
      new RequestMetadata()
          // Make sure to hash your userID
          .setUserId("HashedUserId")
          // Make sure to hash the sessionID
          .setSessionId("HashedSessionID")
          // Domain of the website where the search is conducted
          .setDomain("www.google.com");

  SearchJobsRequest request =
      new SearchJobsRequest()
          .setRequestMetadata(requestMetadata)
          .setSearchMode("JOB_SEARCH"); // Set the search mode to a regular search
  if (companyName != null) {
    request.setJobQuery(new JobQuery().setCompanyNames(Arrays.asList(companyName)));
  }

  SearchJobsResponse response =
      talentSolutionClient
          .projects()
          .jobs()
          .searchForAlert(DEFAULT_PROJECT_ID, request)
          .execute();
  Thread.sleep(1000);
  System.out.printf("Search jobs for alert results: %s\n", response);
}

Python

Untuk mengetahui informasi lebih lanjut tentang cara menginstal dan membuat klien Cloud Talent Solution, lihat Library Klien Cloud Talent Solution.

def search_for_alerts(client_service, company_name):
    request_metadata = {
        "user_id": "HashedUserId",
        "session_id": "HashedSessionId",
        "domain": "www.google.com",
    }
    request = {
        "search_mode": "JOB_SEARCH",
        "request_metadata": request_metadata,
    }
    if company_name is not None:
        request.update({"job_query": {"company_names": [company_name]}})
    response = (
        client_service.projects()
        .jobs()
        .searchForAlert(parent=parent, body=request)
        .execute()
    )
    print(response)

Go

Untuk mengetahui informasi lebih lanjut tentang cara menginstal dan membuat klien Cloud Talent Solution, lihat Library Klien Cloud Talent Solution.


// searchForAlerts searches for jobs with email alert set which could receive
// updates later if search result updates.
func searchForAlerts(w io.Writer, projectID, companyName string) (*talent.SearchJobsResponse, error) {
	ctx := context.Background()

	client, err := google.DefaultClient(ctx, talent.CloudPlatformScope)
	if err != nil {
		return nil, fmt.Errorf("google.DefaultClient: %w", err)
	}
	// Create the jobs service client.
	service, err := talent.New(client)
	if err != nil {
		return nil, fmt.Errorf("talent.New: %w", err)
	}

	parent := "projects/" + projectID
	req := &talent.SearchJobsRequest{
		// Make sure to set the RequestMetadata the same as the associated
		// search request.
		RequestMetadata: &talent.RequestMetadata{
			// Make sure to hash your userID.
			UserId: "HashedUsrId",
			// Make sure to hash the sessionID.
			SessionId: "HashedSessionId",
			// Domain of the website where the search is conducted.
			Domain: "www.googlesample.com",
		},
		// Set the search mode to a regular search.
		SearchMode: "JOB_SEARCH",
	}
	if companyName != "" {
		req.JobQuery = &talent.JobQuery{
			CompanyNames: []string{companyName},
		}
	}

	resp, err := service.Projects.Jobs.SearchForAlert(parent, req).Do()
	if err != nil {
		return nil, fmt.Errorf("failed to search for jobs with alerts: %w", err)
	}

	fmt.Fprintln(w, "Jobs:")
	for _, j := range resp.MatchingJobs {
		fmt.Fprintf(w, "\t%q\n", j.Job.Name)
	}

	return resp, nil
}

Untuk mengetahui informasi tentang penelusuran, lihat Dasar-Dasar Penelusuran.