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
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

Users Online
Currently online: 185 members 4,079 guests
Please welcome our newest community members: