cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
avizaviz
Level: Power Up

MS Flow - Webhook to MyCred API

Mycred is a wordpress plugin that maintains a point count for users. MYcred has an API that allows you to add points remotely through their API (http://codex.mycred.me/chapter-v/remote-api/v1/). As i am a beginner at best with MS flow and webhooks, i cannot seem to figure out how to send a CREDIT request using microsoft flow.

I tried using the example below while modifying the secure_key, remote_url, and account. I cant seem to get anywhere.  HELP been working on this simple task for a week and cannot figure it out. 

$secret_key = '*mysecretkey*';
$remote_url = 'http://siteb.com/api/';

$action     = 'CREDIT';
$account    = 'john.doe@email.com';
$amount     = 10;
$ref        = 'reference';
$ref_id     = 0;
$entry      = 'Points for viewing video';
$data       = 'optional extra';
$point_type = 'my_custom_type';
$host       = get_bloginfo( 'url' );

$token      = md5( $host . $action . $amount . $secret_key );

$request    = array(
	'method' => 'POST',
	'body'   => array(
		'action'  => $action,
		'account' => $account,
		'amount'  => $amount,
		'ref'     => $ref,
		'ref_id'  => $ref_id,
		'type'    => $point_type,
		'entry'   => $entry,
		'data'    => $data,
		'token'   => $token,
		'host'    => $host
	)
);

    $response = wp_remote_post( $remote_url, $request ); 
1 REPLY 1

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,578)