Skip to content

Instantly share code, notes, and snippets.

@pcave
Created February 24, 2015 22:36
Show Gist options
  • Save pcave/08edf83da05ae7983a38 to your computer and use it in GitHub Desktop.
Save pcave/08edf83da05ae7983a38 to your computer and use it in GitHub Desktop.
Message Creation Cept
<?php
$I = new ApiTester($scenario);
$I->wantTo('Verify message extraction and preparation tasks.');
$I->haveEnabledFilters();
// Get an access token to use in subsequent requests
$I->getAccessToken($I);
$responseData = json_decode($I->grabResponse());
$message = '{
"alertId":"54c6a763c00d7",
"testMode":true,
"testEmail":"[email protected]",
"contact":{
"id":10,
"firstName":"Joe",
"lastName":"Joe",
"email":"[email protected]"
},
"messages":[
{
"message":{
"id":"54c6a763c00c7",
"subject":"You Rock the socks! [target:salutation] [target:firstName] [target:lastName]",
"body":" Dear [target:salutation] [target:firstName] [target:lastName],\nBacon ipsum dolor amet ball tip tri-tip tongue pig.\nBacon ribeye capicola tenderloin venison flank. Ball tip tenderloin filet mignon ground round, ham hock chicken brisket shankle pork chop. Brisket doner corned beef sirloin, pig filet mignon rump shoulder.\n\n"
},
"deliverable":[
{
"fecId":"S4NJ00185",
"salutation":"Rep.",
"firstName":"Cory",
"lastName":"Booker",
"email":"[email protected]",
"gender": "M",
"state": "OR",
"role": "FH",
"districtCode": "OR01",
"districtName": "Oregon District 1"
}
],
"undeliverable":[
]
}
]
}';
$message = json_decode($message, true);
$I->sendPOST('/api/v1/message/create', [
'access_token' => $responseData->access_token,
'message' => $message
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment