• Hi, I’m working with WP Webhooks to create new posts and also upload media to use as the featured image. WP Webhooks can call custom PHP actions as well. Right now I upload the image to my server, then add it to library to get the media I’d for the post’s featured image. Is there a way I can use your plugin to upload to Wasabi and then attach it to a post as it’s featured image? If so, how would I go about doing that?

    Thanks!
    AJ

Viewing 1 replies (of 1 total)
  • Hey @ajtatum – Jannis here from WP Webhooks.
    I’ve quickly looked over the plugin, and there is a REST API endpoint available that you can use to create the image. Here’s the code snippet in regards to that:

    // Show file under media library after upload.
    register_rest_route( 'ssu/v1', '/wp-media', array(
    	'methods'             => 'POST',
    	'callback'            => array( $this, 'create_wp_media' ),
    	'permission_callback' => function () use ( $capability ) {
    		return current_user_can( $capability );
    	},
    ) );

    This allows you to create an attachment using the following keys:
    {
    “file”: “”,
    “signedUrl”: “”
    }

    To make it work with WP Webhooks, you can send a webhook request along with an authentication template using basic authentication (That’s possible since WP Webhooks Pro 6.1.0).
    Here’s the description of that endpoint: https://wp-webhooks.com/integrations/webhooks/actions/send_request/

    I haven’t tested it myself, but the process should be pretty straight forward.

Viewing 1 replies (of 1 total)
  • The topic ‘Upload photos programmatically or via WP Webhook?’ is closed to new replies.