Skip to content

Commit 0680817

Browse files
Update to readme and bypassing email feature
1 parent b6fa9fe commit 0680817

File tree

2 files changed

+54
-7
lines changed

2 files changed

+54
-7
lines changed

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ For cross-posts to work successfully, there are a few prereqs that must be met i
1717
* You have an application in [AWS Amplify](https://aws.amazon.com/amplify/) that has a runnable CI pipeline
1818
* Blog posts have front matter in the format outlined in the [Blog Metadata](#blog-metadata) section
1919

20+
*Note - it is highly recommended you host your blog on your own site. This guarantees you own your content and prevents accidental loss if your favorite platform goes down or has an incident. It also enables [easy canonification](https://support.google.com/webmasters/answer/10347851) of your content when it is cross posted so it ranks higher in search engine results. For a step by step guide on hosting your own blog for free, please [reference this post](https://www.readysetcloud.io/blog/allen.helton/how-to-build-your-blog-with-aws-and-hugo/).*
21+
2022
## How It Works
2123

2224
![](/docs/workflow.png)
@@ -38,11 +40,13 @@ The cross posting process is outlined below.
3840

3941
This solution will take content you create and automatically cross-post it on three platforms:
4042

41-
* [Medium](https://medium.com)
42-
* [Dev.to](https://dev.to)
43-
* [Hashnode](https://hashnode.com)
43+
* [Medium](https://medium.com) - *[generate API Key](https://help.medium.com/hc/en-us/articles/213480228-Get-an-integration-token-for-your-writing-app)*
44+
* [Dev.to](https://dev.to) - *[generate API Key](https://dev.to/settings/extensions)*
45+
* [Hashnode](https://hashnode.com) - *[generate API Key](https://hashnode.com/settings/developer)*
4446

47+
You are required to have an account on all three platforms and must generate an API key for each of them.
4548

49+
Optionally, you can publish straight to publications on each of the platforms. If there is a specific organization on Dev.to or publication on Medium or Hashnode you typically write for, you can fill out `DevOrganizationId`, `MediumPublicationId`, and `HashnodePublicationId` deployment variables respectively. For example, you could automatically submit your story to the [AWS Community Builders](https://dev.to/aws-builders) organization on dev.to instead of under your name.
4650

4751
## Deployment
4852

@@ -88,7 +92,7 @@ If you wish to get notification emails on the status of the cross posting, you m
8892

8993
Once you perform the above actions, you may use the values in the respective deployment variables listed above.
9094

91-
## Replay
95+
## Replay / Idempotency
9296

9397
In the event the cross-posting does not work, it can be safely retried without worrying about pushing your content multiple times. Each post will update the idempotency DynamoDB record for the cross-posting state machine. This record holds the status (*success/failure*) for each platform. If the article was successfully posted on a platform, it will be skipped on subsequent executions.
9498

workflows/cross-post.asl.json

+46-3
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,31 @@
769769
}
770770
},
771771
"ResultPath": null,
772-
"Next": "Send Failure Email"
772+
"Next": "Should Send Failure Email?"
773+
},
774+
"Should Send Failure Email?": {
775+
"Type": "Choice",
776+
"Choices": [
777+
{
778+
"And": [
779+
{
780+
"Variable": "$$.Execution.Input.sendStatusEmail",
781+
"IsPresent": true
782+
},
783+
{
784+
"Variable": "$$.Execution.Input.sendStatusEmail",
785+
"BooleanEquals": true
786+
}
787+
],
788+
"Next": "Send Failure Email"
789+
}
790+
],
791+
"Default": "Something Went Wrong"
792+
},
793+
"Something Went Wrong": {
794+
"Type": "Fail",
795+
"Error": "PublishError",
796+
"Cause": "An error occurred publishing to one or more sites"
773797
},
774798
"Send Failure Email": {
775799
"Type": "Task",
@@ -787,7 +811,7 @@
787811
}
788812
]
789813
},
790-
"End": true
814+
"Next": "Something Went Wrong"
791815
},
792816
"Format Catalog Article": {
793817
"Type": "Pass",
@@ -801,7 +825,7 @@
801825
},
802826
"Save Records": {
803827
"Type": "Parallel",
804-
"Next": "Send Success Email",
828+
"Next": "Should Send Success Email?",
805829
"Branches": [
806830
{
807831
"StartAt": "Save Catalog Article",
@@ -881,6 +905,25 @@
881905
],
882906
"ResultPath": null
883907
},
908+
"Should Send Success Email?": {
909+
"Type": "Choice",
910+
"Choices": [
911+
{
912+
"And": [
913+
{
914+
"Variable": "$$.Execution.Input.sendStatusEmail",
915+
"IsPresent": true
916+
},
917+
{
918+
"Variable": "$$.Execution.Input.sendStatusEmail",
919+
"BooleanEquals": true
920+
}
921+
],
922+
"Next": "Send Success Email"
923+
}
924+
],
925+
"Default": "Success"
926+
},
884927
"Send Success Email": {
885928
"Type": "Task",
886929
"Resource": "${EventBridgePutEvents}",

0 commit comments

Comments
 (0)