cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (5,700)