question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Send Idea Hub activities on certain Idea Hub post interactions

See original GitHub issue

The Idea Hub API offers a platforms.properties.ideaActivities.create endpoint which expects information about activities related to an idea and content creation. The API is currently being finalized, so this issue is pending that work - ACs will be added as soon as possible.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The Google API client services library should be updated to at least a version so that it includes the latest state of the Idea Hub API platforms.properties.ideaActivities.create endpoint. This work may overlap with #3916, pending whether the Beta update comes in the same release as the API enhancements needed here.
  • For the following Idea Hub interactions, a POST request to the above endpoint (https://ideahub.googleapis.com/v1alpha/{parent=platforms/*/properties/*}/ideaActivities) should be sent using the respective Google API client services method (the class will likely be PlatformsPropertiesIdeaActivities and the method will likely be create; a parent value will need to be specified similar to the ideas endpoint):
    • When an idea draft post is created, the request should include the respective idea ID and the POST_DRAFTED activity.
    • When an idea post is published, the request should include the respective idea ID and the POST_PUBLISHED activity, including the published post URL.
    • When an idea post is published, the request should include the respective idea ID and the POST_UNPUBLISHED activity.
    • When an idea post is deleted, the request should include the respective idea ID and the POST_DELETED activity.
  • In all cases, the data to send in the API request needs to be in the following shape:
{
  "ideas": [
    "Idea ID goes in here (not the full idea name, just the ID part)"
  ],
  "topics": [],
  "type": "one of POST_DRAFTED, POST_PUBLISHED, POST_UNPUBLISHED, POST_DELETED",
  "uri": "public post URL if available (depends on the activity type, e.g. a draft post doesn't have a public URL)"
}

Implementation Brief

  • Upgrade the google/apiclient-services dependency to >=0.210 version.
    • Verify functionality of existing modules to make sure nothing is broken after the upgrade.
  • Edit the Idea_Hub class:
    • Create a new private method track_idea_activity( $post_id, $type ):
      • Get the associated idea name. Return early if the post doesn’t have the associated idea.
      • Create a new instance of the GoogleSearchIdeahubV1alphaIdeaActivity class.
        • Set ideas (using setIdeas method) passing an array with the idea ID extracted from the post idea name.
        • Set idea topics (using setTopics method) passing an empty array.
        • Set the activity type (using setType method) passing the incoming $type variable.
        • If the post is published, set the post URI (using setUri method).
      • Get the parent slug using the $this->get_parent_slug() method.
      • Create an activity entry by calling $this->get_service( 'ideahub' )->platforms_properties_ideaActivities->create( $parent, $activity ) method.
    • Update the on_idea_hub_post_status_transition method to call the track_idea_activity method with:
      • POST_PUBLISHED type if the new status is published and it doesn’t equal the old status.
      • POST_UNPUBLISHED type if the old status is published and it doens’t equal the new status.
    • Update the POST:create-idea-draft-post case in the create_data_request method to call the track_idea_activity method with the POST_DRAFTED type.
    • Add a new hook for the pre_delete_post action in the register method (if the module is connected) that calls the track_idea_activity method with the POST_DELETED type.

Test Coverage

  • N/A

Visual Regression Changes

  • N/A

QA Brief

Changelog entry

  • Use Idea Hub activities endpoint when drafting, publishing or deleting a post.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
rzhwcommented, Sep 6, 2021

@eugene-manuilov Hi, posting on behalf of API team here, we’ve just had a push to prod and the URI should no longer be required.

1reaction
eugene-manuilovcommented, Sep 6, 2021

@rzhw I can confirm that the existing functionality in v0.210.0 works correctly on my local machine. I get correct responses for all activities and it doesn’t require URI for non-published posts anymore.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IDEA Hub Projects - Creighton University
The IDEA Hub has a large variety of projects that come to us through different avenues to help create a stronger more impactful...
Read more >
What is Idea Hub? | WordPress.org
Idea Hub is a new feature coming to Site Kit that will provide clients with ideas for new content to create. It'll suggest...
Read more >
Xbox Idea Hub - Reddit - Dive into anything
An Idea Drive is a structured method for collecting ideas and suggestions from our most passionate fans across Windows and Xbox console. Here's...
Read more >
Idea Sharing: How To Share Ideas In The Workplace
Bouncing ideas of colleagues, sharing insights as well as offering different experiences and feedback can result in breakthrough thinking.
Read more >
How do I create a new idea conversation in the Ins...
The Community platform automatically searches for similar ideas using keywords in your idea subject. If you see a similar idea, click the idea...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found